[−][src]Struct sixtyfps_corelib::string::SharedString
A string type used by the SixtyFPS run-time.
SharedString uses implicit data sharing to make it efficient to pass around copies. When cloning, a reference to the data is cloned, not the data itself. The data itself is only copied when modifying it, for example using push_str. This is also called copy-on-write.
Under the hood the string data is UTF-8 encoded and it is always terminated with a null character.
Implementations
impl SharedString
[src]
pub fn len(&self) -> usize
[src]
Size of the string, in bytes. This excludes the terminating null character.
pub fn as_str(&self) -> &str
[src]
Return a slice to the string
pub fn push_str(&mut self, x: &str)
[src]
Append a string to this string
let mut hello = SharedString::from("Hello"); hello.push_str(", "); hello.push_str("World"); hello.push_str("!"); assert_eq!(hello, "Hello, World!");
Trait Implementations
impl<'_> Add<&'_ str> for SharedString
[src]
type Output = SharedString
The resulting type after applying the +
operator.
pub fn add(self, other: &str) -> SharedString
[src]
impl<'_> AddAssign<&'_ str> for SharedString
[src]
pub fn add_assign(&mut self, other: &str)
[src]
impl AsRef<[u8]> for SharedString
[src]
impl AsRef<CStr> for SharedString
[src]
impl AsRef<str> for SharedString
[src]
impl Clone for SharedString
[src]
pub fn clone(&self) -> SharedString
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for SharedString
[src]
impl Default for SharedString
[src]
impl Deref for SharedString
[src]
impl Display for SharedString
[src]
impl Eq for SharedString
[src]
impl<'_> From<&'_ String> for SharedString
[src]
impl<'_> From<&'_ str> for SharedString
[src]
impl From<String> for SharedString
[src]
impl Hash for SharedString
[src]
pub fn hash<H: Hasher>(&self, state: &mut H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Into<String> for SharedString
[src]
impl Ord for SharedString
[src]
pub fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<T: ?Sized> PartialEq<T> for SharedString where
T: AsRef<str>,
[src]
T: AsRef<str>,
impl<T: ?Sized> PartialOrd<T> for SharedString where
T: AsRef<str>,
[src]
T: AsRef<str>,
Auto Trait Implementations
impl RefUnwindSafe for SharedString
impl Send for SharedString
impl Sync for SharedString
impl Unpin for SharedString
impl UnwindSafe for SharedString
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,