Struct rhai::plugin::ImmutableString [−][src]
pub struct ImmutableString(_);
Expand description
The system immutable string type.
An ImmutableString
wraps an Rc
<
String
>
(or Arc
<
String
>
under the sync
feature)
so that it can be simply shared and not cloned.
Example
use rhai::ImmutableString; let s1: ImmutableString = "hello".into(); // No actual cloning of the string is involved below. let s2 = s1.clone(); let s3 = s2.clone(); assert_eq!(s1, s2); // Clones the underlying string (because it is already shared) and extracts it. let mut s: String = s1.into_owned(); // Changing the clone has no impact on the previously shared version. s.push_str(", world!"); // The old version still exists. assert_eq!(s2, s3); assert_eq!(s2.as_str(), "hello"); // Not equals! assert_ne!(s2.as_str(), s.as_str()); assert_eq!(s, "hello, world!");
Implementations
impl ImmutableString
[src]
impl ImmutableString
[src]pub fn into_owned(self) -> String
[src]
pub fn into_owned(self) -> String
[src]Consume the ImmutableString
and convert it into a String
.
If there are other references to the same string, a cloned copy is returned.
Trait Implementations
impl Add<&'_ ImmutableString> for &ImmutableString
[src]
impl Add<&'_ ImmutableString> for &ImmutableString
[src]impl Add<&'_ str> for ImmutableString
[src]
impl Add<&'_ str> for ImmutableString
[src]impl Add<&'_ str> for &ImmutableString
[src]
impl Add<&'_ str> for &ImmutableString
[src]impl Add<ImmutableString> for ImmutableString
[src]
impl Add<ImmutableString> for ImmutableString
[src]impl Add<String> for ImmutableString
[src]
impl Add<String> for ImmutableString
[src]impl Add<String> for &ImmutableString
[src]
impl Add<String> for &ImmutableString
[src]impl Add<char> for ImmutableString
[src]
impl Add<char> for ImmutableString
[src]impl Add<char> for &ImmutableString
[src]
impl Add<char> for &ImmutableString
[src]impl AddAssign<&'_ ImmutableString> for ImmutableString
[src]
impl AddAssign<&'_ ImmutableString> for ImmutableString
[src]fn add_assign(&mut self, rhs: &ImmutableString)
[src]
fn add_assign(&mut self, rhs: &ImmutableString)
[src]Performs the +=
operation. Read more
impl AddAssign<&'_ str> for ImmutableString
[src]
impl AddAssign<&'_ str> for ImmutableString
[src]fn add_assign(&mut self, rhs: &str)
[src]
fn add_assign(&mut self, rhs: &str)
[src]Performs the +=
operation. Read more
impl AddAssign<ImmutableString> for ImmutableString
[src]
impl AddAssign<ImmutableString> for ImmutableString
[src]fn add_assign(&mut self, rhs: ImmutableString)
[src]
fn add_assign(&mut self, rhs: ImmutableString)
[src]Performs the +=
operation. Read more
impl AddAssign<String> for ImmutableString
[src]
impl AddAssign<String> for ImmutableString
[src]fn add_assign(&mut self, rhs: String)
[src]
fn add_assign(&mut self, rhs: String)
[src]Performs the +=
operation. Read more
impl AddAssign<char> for ImmutableString
[src]
impl AddAssign<char> for ImmutableString
[src]fn add_assign(&mut self, rhs: char)
[src]
fn add_assign(&mut self, rhs: char)
[src]Performs the +=
operation. Read more
impl AsRef<SmartString<Compact>> for ImmutableString
[src]
impl AsRef<SmartString<Compact>> for ImmutableString
[src]fn as_ref(&self) -> &SmartString
[src]
fn as_ref(&self) -> &SmartString
[src]Performs the conversion.
impl Borrow<SmartString<Compact>> for ImmutableString
[src]
impl Borrow<SmartString<Compact>> for ImmutableString
[src]fn borrow(&self) -> &SmartString
[src]
fn borrow(&self) -> &SmartString
[src]Immutably borrows from an owned value. Read more
impl Borrow<str> for ImmutableString
[src]
impl Borrow<str> for ImmutableString
[src]impl Clone for ImmutableString
[src]
impl Clone for ImmutableString
[src]fn clone(&self) -> ImmutableString
[src]
fn clone(&self) -> ImmutableString
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for ImmutableString
[src]
impl Debug for ImmutableString
[src]impl Default for ImmutableString
[src]
impl Default for ImmutableString
[src]fn default() -> ImmutableString
[src]
fn default() -> ImmutableString
[src]Returns the “default value” for a type. Read more
impl Deref for ImmutableString
[src]
impl Deref for ImmutableString
[src]type Target = SmartString
type Target = SmartString
The resulting type after dereferencing.
impl<'d> Deserialize<'d> for ImmutableString
[src]
impl<'d> Deserialize<'d> for ImmutableString
[src]fn deserialize<D: Deserializer<'d>>(de: D) -> Result<Self, D::Error>
[src]
fn deserialize<D: Deserializer<'d>>(de: D) -> Result<Self, D::Error>
[src]Deserialize this value from the given Serde deserializer. Read more
impl Display for ImmutableString
[src]
impl Display for ImmutableString
[src]impl From<&'_ ImmutableString> for Dynamic
[src]
impl From<&'_ ImmutableString> for Dynamic
[src]fn from(value: &ImmutableString) -> Self
[src]
fn from(value: &ImmutableString) -> Self
[src]Performs the conversion.
impl From<&'_ String> for ImmutableString
[src]
impl From<&'_ String> for ImmutableString
[src]impl From<&'_ str> for ImmutableString
[src]
impl From<&'_ str> for ImmutableString
[src]impl From<ImmutableString> for SmartString
[src]
impl From<ImmutableString> for SmartString
[src]fn from(value: ImmutableString) -> Self
[src]
fn from(value: ImmutableString) -> Self
[src]Performs the conversion.
impl From<SmartString<Compact>> for ImmutableString
[src]
impl From<SmartString<Compact>> for ImmutableString
[src]fn from(value: SmartString) -> Self
[src]
fn from(value: SmartString) -> Self
[src]Performs the conversion.
impl From<String> for ImmutableString
[src]
impl From<String> for ImmutableString
[src]impl<'a> FromIterator<&'a char> for ImmutableString
[src]
impl<'a> FromIterator<&'a char> for ImmutableString
[src]fn from_iter<T: IntoIterator<Item = &'a char>>(iter: T) -> Self
[src]
fn from_iter<T: IntoIterator<Item = &'a char>>(iter: T) -> Self
[src]Creates a value from an iterator. Read more
impl<'a> FromIterator<&'a str> for ImmutableString
[src]
impl<'a> FromIterator<&'a str> for ImmutableString
[src]fn from_iter<T: IntoIterator<Item = &'a str>>(iter: T) -> Self
[src]
fn from_iter<T: IntoIterator<Item = &'a str>>(iter: T) -> Self
[src]Creates a value from an iterator. Read more
impl<'a> FromIterator<SmartString<Compact>> for ImmutableString
[src]
impl<'a> FromIterator<SmartString<Compact>> for ImmutableString
[src]fn from_iter<T: IntoIterator<Item = SmartString>>(iter: T) -> Self
[src]
fn from_iter<T: IntoIterator<Item = SmartString>>(iter: T) -> Self
[src]Creates a value from an iterator. Read more
impl<'a> FromIterator<String> for ImmutableString
[src]
impl<'a> FromIterator<String> for ImmutableString
[src]fn from_iter<T: IntoIterator<Item = String>>(iter: T) -> Self
[src]
fn from_iter<T: IntoIterator<Item = String>>(iter: T) -> Self
[src]Creates a value from an iterator. Read more
impl FromIterator<char> for ImmutableString
[src]
impl FromIterator<char> for ImmutableString
[src]fn from_iter<T: IntoIterator<Item = char>>(iter: T) -> Self
[src]
fn from_iter<T: IntoIterator<Item = char>>(iter: T) -> Self
[src]Creates a value from an iterator. Read more
impl FromStr for ImmutableString
[src]
impl FromStr for ImmutableString
[src]impl Hash for ImmutableString
[src]
impl Hash for ImmutableString
[src]impl Ord for ImmutableString
[src]
impl Ord for ImmutableString
[src]impl<S: AsRef<str>> PartialEq<S> for ImmutableString
[src]
impl<S: AsRef<str>> PartialEq<S> for ImmutableString
[src]impl<S: AsRef<str>> PartialOrd<S> for ImmutableString
[src]
impl<S: AsRef<str>> PartialOrd<S> for ImmutableString
[src]fn partial_cmp(&self, other: &S) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &S) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Serialize for ImmutableString
[src]
impl Serialize for ImmutableString
[src]impl Sub<&'_ ImmutableString> for &ImmutableString
[src]
impl Sub<&'_ ImmutableString> for &ImmutableString
[src]impl Sub<ImmutableString> for ImmutableString
[src]
impl Sub<ImmutableString> for ImmutableString
[src]impl Sub<String> for ImmutableString
[src]
impl Sub<String> for ImmutableString
[src]impl Sub<String> for &ImmutableString
[src]
impl Sub<String> for &ImmutableString
[src]impl Sub<char> for ImmutableString
[src]
impl Sub<char> for ImmutableString
[src]impl Sub<char> for &ImmutableString
[src]
impl Sub<char> for &ImmutableString
[src]impl SubAssign<&'_ ImmutableString> for ImmutableString
[src]
impl SubAssign<&'_ ImmutableString> for ImmutableString
[src]fn sub_assign(&mut self, rhs: &ImmutableString)
[src]
fn sub_assign(&mut self, rhs: &ImmutableString)
[src]Performs the -=
operation. Read more
impl SubAssign<ImmutableString> for ImmutableString
[src]
impl SubAssign<ImmutableString> for ImmutableString
[src]fn sub_assign(&mut self, rhs: ImmutableString)
[src]
fn sub_assign(&mut self, rhs: ImmutableString)
[src]Performs the -=
operation. Read more
impl SubAssign<String> for ImmutableString
[src]
impl SubAssign<String> for ImmutableString
[src]fn sub_assign(&mut self, rhs: String)
[src]
fn sub_assign(&mut self, rhs: String)
[src]Performs the -=
operation. Read more
impl SubAssign<char> for ImmutableString
[src]
impl SubAssign<char> for ImmutableString
[src]fn sub_assign(&mut self, rhs: char)
[src]
fn sub_assign(&mut self, rhs: char)
[src]Performs the -=
operation. Read more
impl TryFrom<ImmutableString> for FnPtr
[src]
impl TryFrom<ImmutableString> for FnPtr
[src]type Error = Box<EvalAltResult>
type Error = Box<EvalAltResult>
The type returned in the event of a conversion error.
fn try_from(value: ImmutableString) -> Result<Self, Self::Error>
[src]
fn try_from(value: ImmutableString) -> Result<Self, Self::Error>
[src]Performs the conversion.
impl Eq for ImmutableString
[src]
impl StructuralEq for ImmutableString
[src]
Auto Trait Implementations
impl !RefUnwindSafe for ImmutableString
impl !Send for ImmutableString
impl !Sync for ImmutableString
impl Unpin for ImmutableString
impl UnwindSafe for ImmutableString
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> CallHasher for T where
T: Hash + ?Sized,
[src]
impl<T> CallHasher for T where
T: Hash + ?Sized,
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,