[−][src]Struct mutiny::skinning::components::BoneName
Methods from Deref<Target = String>
pub fn as_str(&self) -> &str
1.7.0[src]
pub fn as_str(&self) -> &str
Extracts a string slice containing the entire String
.
Examples
Basic usage:
let s = String::from("foo"); assert_eq!("foo", s.as_str());
pub fn as_mut_str(&mut self) -> &mut str
1.7.0[src]
pub fn as_mut_str(&mut self) -> &mut str
Converts a String
into a mutable string slice.
Examples
Basic usage:
let mut s = String::from("foobar"); let s_mut_str = s.as_mut_str(); s_mut_str.make_ascii_uppercase(); assert_eq!("FOOBAR", s_mut_str);
pub fn push_str(&mut self, string: &str)
1.0.0[src]
pub fn push_str(&mut self, string: &str)
Appends a given string slice onto the end of this String
.
Examples
Basic usage:
let mut s = String::from("foo"); s.push_str("bar"); assert_eq!("foobar", s);
pub fn capacity(&self) -> usize
1.0.0[src]
pub fn capacity(&self) -> usize
Returns this String
's capacity, in bytes.
Examples
Basic usage:
let s = String::with_capacity(10); assert!(s.capacity() >= 10);
pub fn reserve(&mut self, additional: usize)
1.0.0[src]
pub fn reserve(&mut self, additional: usize)
Ensures that this String
's capacity is at least additional
bytes
larger than its length.
The capacity may be increased by more than additional
bytes if it
chooses, to prevent frequent reallocations.
If you do not want this "at least" behavior, see the reserve_exact
method.
Panics
Panics if the new capacity overflows usize
.
Examples
Basic usage:
let mut s = String::new(); s.reserve(10); assert!(s.capacity() >= 10);
This may not actually increase the capacity:
let mut s = String::with_capacity(10); s.push('a'); s.push('b'); // s now has a length of 2 and a capacity of 10 assert_eq!(2, s.len()); assert_eq!(10, s.capacity()); // Since we already have an extra 8 capacity, calling this... s.reserve(8); // ... doesn't actually increase. assert_eq!(10, s.capacity());
pub fn reserve_exact(&mut self, additional: usize)
1.0.0[src]
pub fn reserve_exact(&mut self, additional: usize)
Ensures that this String
's capacity is additional
bytes
larger than its length.
Consider using the reserve
method unless you absolutely know
better than the allocator.
Panics
Panics if the new capacity overflows usize
.
Examples
Basic usage:
let mut s = String::new(); s.reserve_exact(10); assert!(s.capacity() >= 10);
This may not actually increase the capacity:
let mut s = String::with_capacity(10); s.push('a'); s.push('b'); // s now has a length of 2 and a capacity of 10 assert_eq!(2, s.len()); assert_eq!(10, s.capacity()); // Since we already have an extra 8 capacity, calling this... s.reserve_exact(8); // ... doesn't actually increase. assert_eq!(10, s.capacity());
pub fn try_reserve(
&mut self,
additional: usize
) -> Result<(), CollectionAllocErr>
[src]
pub fn try_reserve(
&mut self,
additional: usize
) -> Result<(), CollectionAllocErr>
🔬 This is a nightly-only experimental API. (try_reserve
)
new API
Tries to reserve capacity for at least additional
more elements to be inserted
in the given String
. The collection may reserve more space to avoid
frequent reallocations. After calling reserve
, capacity will be
greater than or equal to self.len() + additional
. Does nothing if
capacity is already sufficient.
Errors
If the capacity overflows, or the allocator reports a failure, then an error is returned.
Examples
#![feature(try_reserve)] use std::collections::CollectionAllocErr; fn process_data(data: &str) -> Result<String, CollectionAllocErr> { let mut output = String::new(); // Pre-reserve the memory, exiting if we can't output.try_reserve(data.len())?; // Now we know this can't OOM in the middle of our complex work output.push_str(data); Ok(output) }
pub fn try_reserve_exact(
&mut self,
additional: usize
) -> Result<(), CollectionAllocErr>
[src]
pub fn try_reserve_exact(
&mut self,
additional: usize
) -> Result<(), CollectionAllocErr>
🔬 This is a nightly-only experimental API. (try_reserve
)
new API
Tries to reserves the minimum capacity for exactly additional
more elements to
be inserted in the given String
. After calling reserve_exact
,
capacity will be greater than or equal to self.len() + additional
.
Does nothing if the capacity is already sufficient.
Note that the allocator may give the collection more space than it
requests. Therefore capacity can not be relied upon to be precisely
minimal. Prefer reserve
if future insertions are expected.
Errors
If the capacity overflows, or the allocator reports a failure, then an error is returned.
Examples
#![feature(try_reserve)] use std::collections::CollectionAllocErr; fn process_data(data: &str) -> Result<String, CollectionAllocErr> { let mut output = String::new(); // Pre-reserve the memory, exiting if we can't output.try_reserve(data.len())?; // Now we know this can't OOM in the middle of our complex work output.push_str(data); Ok(output) }
pub fn shrink_to_fit(&mut self)
1.0.0[src]
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of this String
to match its length.
Examples
Basic usage:
let mut s = String::from("foo"); s.reserve(100); assert!(s.capacity() >= 100); s.shrink_to_fit(); assert_eq!(3, s.capacity());
pub fn shrink_to(&mut self, min_capacity: usize)
[src]
pub fn shrink_to(&mut self, min_capacity: usize)
🔬 This is a nightly-only experimental API. (shrink_to
)
new API
Shrinks the capacity of this String
with a lower bound.
The capacity will remain at least as large as both the length and the supplied value.
Panics if the current capacity is smaller than the supplied minimum capacity.
Examples
#![feature(shrink_to)] let mut s = String::from("foo"); s.reserve(100); assert!(s.capacity() >= 100); s.shrink_to(10); assert!(s.capacity() >= 10); s.shrink_to(0); assert!(s.capacity() >= 3);
pub fn push(&mut self, ch: char)
1.0.0[src]
pub fn push(&mut self, ch: char)
Appends the given char
to the end of this String
.
Examples
Basic usage:
let mut s = String::from("abc"); s.push('1'); s.push('2'); s.push('3'); assert_eq!("abc123", s);
pub fn as_bytes(&self) -> &[u8]
1.0.0[src]
pub fn as_bytes(&self) -> &[u8]
Returns a byte slice of this String
's contents.
The inverse of this method is from_utf8
.
Examples
Basic usage:
let s = String::from("hello"); assert_eq!(&[104, 101, 108, 108, 111], s.as_bytes());
pub fn truncate(&mut self, new_len: usize)
1.0.0[src]
pub fn truncate(&mut self, new_len: usize)
Shortens this String
to the specified length.
If new_len
is greater than the string's current length, this has no
effect.
Note that this method has no effect on the allocated capacity of the string
Panics
Panics if new_len
does not lie on a char
boundary.
Examples
Basic usage:
let mut s = String::from("hello"); s.truncate(2); assert_eq!("he", s);
pub fn pop(&mut self) -> Option<char>
1.0.0[src]
pub fn pop(&mut self) -> Option<char>
Removes the last character from the string buffer and returns it.
Returns None
if this String
is empty.
Examples
Basic usage:
let mut s = String::from("foo"); assert_eq!(s.pop(), Some('o')); assert_eq!(s.pop(), Some('o')); assert_eq!(s.pop(), Some('f')); assert_eq!(s.pop(), None);
pub fn remove(&mut self, idx: usize) -> char
1.0.0[src]
pub fn remove(&mut self, idx: usize) -> char
Removes a char
from this String
at a byte position and returns it.
This is an O(n)
operation, as it requires copying every element in the
buffer.
Panics
Panics if idx
is larger than or equal to the String
's length,
or if it does not lie on a char
boundary.
Examples
Basic usage:
let mut s = String::from("foo"); assert_eq!(s.remove(0), 'f'); assert_eq!(s.remove(1), 'o'); assert_eq!(s.remove(0), 'o');
pub fn retain<F>(&mut self, f: F) where
F: FnMut(char) -> bool,
1.26.0[src]
pub fn retain<F>(&mut self, f: F) where
F: FnMut(char) -> bool,
Retains only the characters specified by the predicate.
In other words, remove all characters c
such that f(c)
returns false
.
This method operates in place and preserves the order of the retained
characters.
Examples
let mut s = String::from("f_o_ob_ar"); s.retain(|c| c != '_'); assert_eq!(s, "foobar");
pub fn insert(&mut self, idx: usize, ch: char)
1.0.0[src]
pub fn insert(&mut self, idx: usize, ch: char)
Inserts a character into this String
at a byte position.
This is an O(n)
operation as it requires copying every element in the
buffer.
Panics
Panics if idx
is larger than the String
's length, or if it does not
lie on a char
boundary.
Examples
Basic usage:
let mut s = String::with_capacity(3); s.insert(0, 'f'); s.insert(1, 'o'); s.insert(2, 'o'); assert_eq!("foo", s);
pub fn insert_str(&mut self, idx: usize, string: &str)
1.16.0[src]
pub fn insert_str(&mut self, idx: usize, string: &str)
Inserts a string slice into this String
at a byte position.
This is an O(n)
operation as it requires copying every element in the
buffer.
Panics
Panics if idx
is larger than the String
's length, or if it does not
lie on a char
boundary.
Examples
Basic usage:
let mut s = String::from("bar"); s.insert_str(0, "foo"); assert_eq!("foobar", s);
pub unsafe fn as_mut_vec(&mut self) -> &mut Vec<u8>
1.0.0[src]
pub unsafe fn as_mut_vec(&mut self) -> &mut Vec<u8>
Returns a mutable reference to the contents of this String
.
Safety
This function is unsafe because it does not check that the bytes passed
to it are valid UTF-8. If this constraint is violated, it may cause
memory unsafety issues with future users of the String
, as the rest of
the standard library assumes that String
s are valid UTF-8.
Examples
Basic usage:
let mut s = String::from("hello"); unsafe { let vec = s.as_mut_vec(); assert_eq!(&[104, 101, 108, 108, 111][..], &vec[..]); vec.reverse(); } assert_eq!(s, "olleh");
pub fn len(&self) -> usize
1.0.0[src]
pub fn len(&self) -> usize
Returns the length of this String
, in bytes.
Examples
Basic usage:
let a = String::from("foo"); assert_eq!(a.len(), 3);
pub fn is_empty(&self) -> bool
1.0.0[src]
pub fn is_empty(&self) -> bool
Returns true
if this String
has a length of zero.
Returns false
otherwise.
Examples
Basic usage:
let mut v = String::new(); assert!(v.is_empty()); v.push('a'); assert!(!v.is_empty());
pub fn split_off(&mut self, at: usize) -> String
1.16.0[src]
pub fn split_off(&mut self, at: usize) -> String
Splits the string into two at the given index.
Returns a newly allocated String
. self
contains bytes [0, at)
, and
the returned String
contains bytes [at, len)
. at
must be on the
boundary of a UTF-8 code point.
Note that the capacity of self
does not change.
Panics
Panics if at
is not on a UTF-8
code point boundary, or if it is beyond the last
code point of the string.
Examples
let mut hello = String::from("Hello, World!"); let world = hello.split_off(7); assert_eq!(hello, "Hello, "); assert_eq!(world, "World!");
pub fn clear(&mut self)
1.0.0[src]
pub fn clear(&mut self)
Truncates this String
, removing all contents.
While this means the String
will have a length of zero, it does not
touch its capacity.
Examples
Basic usage:
let mut s = String::from("foo"); s.clear(); assert!(s.is_empty()); assert_eq!(0, s.len()); assert_eq!(3, s.capacity());
pub fn drain<R>(&mut self, range: R) -> Drain where
R: RangeBounds<usize>,
1.6.0[src]
pub fn drain<R>(&mut self, range: R) -> Drain where
R: RangeBounds<usize>,
Creates a draining iterator that removes the specified range in the String
and yields the removed chars
.
Note: The element range is removed even if the iterator is not consumed until the end.
Panics
Panics if the starting point or end point do not lie on a char
boundary, or if they're out of bounds.
Examples
Basic usage:
let mut s = String::from("α is alpha, β is beta"); let beta_offset = s.find('β').unwrap_or(s.len()); // Remove the range up until the β from the string let t: String = s.drain(..beta_offset).collect(); assert_eq!(t, "α is alpha, "); assert_eq!(s, "β is beta"); // A full range clears the string s.drain(..); assert_eq!(s, "");
pub fn replace_range<R>(&mut self, range: R, replace_with: &str) where
R: RangeBounds<usize>,
1.27.0[src]
pub fn replace_range<R>(&mut self, range: R, replace_with: &str) where
R: RangeBounds<usize>,
Removes the specified range in the string, and replaces it with the given string. The given string doesn't need to be the same length as the range.
Panics
Panics if the starting point or end point do not lie on a char
boundary, or if they're out of bounds.
Examples
Basic usage:
let mut s = String::from("α is alpha, β is beta"); let beta_offset = s.find('β').unwrap_or(s.len()); // Replace the range up until the β from the string s.replace_range(..beta_offset, "Α is capital alpha; "); assert_eq!(s, "Α is capital alpha; β is beta");
Trait Implementations
impl PartialEq<BoneName> for BoneName
[src]
impl PartialEq<BoneName> for BoneName
impl Clone for BoneName
[src]
impl Clone for BoneName
fn clone(&self) -> BoneName
[src]
fn clone(&self) -> BoneName
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Eq for BoneName
[src]
impl Eq for BoneName
impl Display for BoneName
[src]
impl Display for BoneName
impl Debug for BoneName
[src]
impl Debug for BoneName
impl Deref for BoneName
[src]
impl Deref for BoneName
impl DerefMut for BoneName
[src]
impl DerefMut for BoneName
impl Component for BoneName
[src]
impl Component for BoneName
impl<'a> DebugParameter for BoneName
[src]
impl<'a> DebugParameter for BoneName
fn debug<S: Serializer>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
[src]
fn debug<S: Serializer>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
impl Serialize for BoneName
[src]
impl Serialize for BoneName
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
impl<'de> Deserialize<'de> for BoneName
[src]
impl<'de> Deserialize<'de> for BoneName
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
impl<T> ToString for T where
T: Display + ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
impl<C> ComponentSend for C where
C: Component + Send,
[src]
impl<C> ComponentSend for C where
C: Component + Send,
impl<C> ComponentThreadLocal for C where
C: Component,
[src]
impl<C> ComponentThreadLocal for C where
C: Component,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
impl<T> Serialize for T where
T: Serialize + ?Sized,
[src]
impl<T> Serialize for T where
T: Serialize + ?Sized,
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
[src]
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
impl<T> Any for T where
T: Any,
[src]
impl<T> Any for T where
T: Any,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<T> SetParameter for T
[src]
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
[src]
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
Sets value
as a parameter of self
.
impl<T> Same for T
[src]
impl<T> Same for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf for SP where
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
[src]
fn to_subset(&self) -> Option<SS>
fn is_in_subset(&self) -> bool
[src]
fn is_in_subset(&self) -> bool
unsafe fn to_subset_unchecked(&self) -> SS
[src]
unsafe fn to_subset_unchecked(&self) -> SS
fn from_subset(element: &SS) -> SP
[src]
fn from_subset(element: &SS) -> SP
impl<V> IntoVec for V
[src]
impl<V> IntoVec for V
impl<V> IntoPnt for V
[src]
impl<V> IntoPnt for V
impl<B, P> IntoControlBuilder for P where
B: BuilderFromProperty<P>,
[src]
impl<B, P> IntoControlBuilder for P where
B: BuilderFromProperty<P>,
fn into_builder<S>(self, name: &str, events: S) -> B where
S: Stream<'static, Event>,
[src]
fn into_builder<S>(self, name: &str, events: S) -> B where
S: Stream<'static, Event>,
impl<T, U> IntoDuration for T where
U: FromDuration<T>,
[src]
impl<T, U> IntoDuration for T where
U: FromDuration<T>,
type Error = <U as FromDuration<T>>::Error
fn into_duration(self) -> Result<U, <U as FromDuration<T>>::Error>
[src]
fn into_duration(self) -> Result<U, <U as FromDuration<T>>::Error>