[−][src]Struct swim_structure::item::Text
Value
variant representing a Unicode string.
Examples
Create a Text
value from a primitive str
:
let value = Text::from_str("Hello");
Get a reference to the primitive str
owned by a Text
value:
let value = Text::from_str("Hello, world!"); let primitive = value.as_str();
Concatenate a Text
value with another str
using the +
operator:
let value = Text::from_str("Hello"); let message = value + " " + "world";
Methods
impl<'a> Text<'a>
[src]
pub fn try_hold_str(
hold: &dyn Hold<'a>,
data: &str
) -> Result<Text<'a>, HoldError>
[src]
hold: &dyn Hold<'a>,
data: &str
) -> Result<Text<'a>, HoldError>
pub fn hold_str(hold: &dyn Hold<'a>, data: &str) -> Text<'a>
[src]
pub fn from_str(data: &str) -> Text<'a>
[src]
pub fn is_empty(&self) -> bool
[src]
pub fn len(&self) -> usize
[src]
pub unsafe fn set_len(&mut self, new_len: usize)
[src]
pub fn cap(&self) -> usize
[src]
pub fn as_value(&self) -> &Value<'a>
[src]
Upcasts this Text
reference to a Value
reference.
pub fn as_mut_value(&mut self) -> &mut Value<'a>
[src]
Upcasts this Text
reference to a mutable Value
reference.
pub fn into_value(self) -> Value<'a>
[src]
Upcasts this Text
to a Value
.
pub fn into_item(self) -> Item<'a>
[src]
Upcasts this Text
to an Item
.
pub fn as_ptr(&self) -> *const u8
[src]
pub fn as_mut_ptr(&mut self) -> *mut u8
[src]
pub fn as_slice(&self) -> &[u8]
[src]
pub fn as_str(&self) -> &str
[src]
pub fn as_mut_str(&mut self) -> &mut str
[src]
pub fn try_reserve(&mut self, ext: usize) -> Result<(), HoldError>
[src]
pub fn reserve(&mut self, ext: usize)
[src]
pub fn try_reserve_exact(&mut self, ext: usize) -> Result<(), HoldError>
[src]
pub fn reserve_exact(&mut self, ext: usize)
[src]
pub fn try_reserve_in_place(&mut self, ext: usize) -> Result<(), HoldError>
[src]
pub fn try_reserve_in_place_exact(
&mut self,
ext: usize
) -> Result<(), HoldError>
[src]
&mut self,
ext: usize
) -> Result<(), HoldError>
pub fn try_push(&mut self, c: char) -> Result<(), HoldError>
[src]
pub fn push(&mut self, c: char)
[src]
pub fn try_push_str(&mut self, s: &str) -> Result<(), HoldError>
[src]
pub fn push_str(&mut self, s: &str)
[src]
pub fn try_insert(&mut self, index: usize, c: char) -> Result<(), HoldError>
[src]
pub fn insert(&mut self, index: usize, c: char)
[src]
pub fn try_insert_str(&mut self, index: usize, s: &str) -> Result<(), HoldError>
[src]
pub fn insert_str(&mut self, index: usize, s: &str)
[src]
pub unsafe fn try_insert_slice(
&mut self,
index: usize,
slice: &[u8]
) -> Result<(), HoldError>
[src]
&mut self,
index: usize,
slice: &[u8]
) -> Result<(), HoldError>
pub unsafe fn insert_slice(&mut self, index: usize, slice: &[u8])
[src]
pub fn pop(&mut self) -> Option<char>
[src]
pub fn remove(&mut self, index: usize) -> char
[src]
pub fn clear(&mut self)
[src]
Trait Implementations
impl<'a> PartialEq<Text<'a>> for Text<'a>
[src]
impl<'a> Eq for Text<'a>
[src]
impl<'a> Ord for Text<'a>
[src]
fn cmp(&self, other: &Text<'a>) -> Ordering
[src]
default fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
default fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
default fn clamp(self, min: Self, max: Self) -> Self
[src]
clamp
)Restrict a value to a certain interval. Read more
impl<'a> PartialOrd<Text<'a>> for Text<'a>
[src]
fn partial_cmp(&self, that: &Text<'a>) -> Option<Ordering>
[src]
fn lt(&self, that: &Text<'a>) -> bool
[src]
fn le(&self, that: &Text<'a>) -> bool
[src]
fn ge(&self, that: &Text<'a>) -> bool
[src]
fn gt(&self, that: &Text<'a>) -> bool
[src]
impl<'a> Deref for Text<'a>
[src]
impl<'a> From<Text<'a>> for Item<'a>
[src]
impl<'a> From<Text<'a>> for Value<'a>
[src]
impl<'a> Display for Text<'a>
[src]
impl<'a> Debug for Text<'a>
[src]
impl<'a, 'b> Add<&'b str> for Text<'a>
[src]
type Output = Text<'a>
The resulting type after applying the +
operator.
fn add(self, rhs: &'b str) -> Text<'a>
[src]
impl<'a, 'b> AddAssign<&'b str> for Text<'a>
[src]
fn add_assign(&mut self, rhs: &'b str)
[src]
impl<'a> DerefMut for Text<'a>
[src]
impl<'a> Drop for Text<'a>
[src]
impl<'a> Index<Range<usize>> for Text<'a>
[src]
type Output = str
The returned type after indexing.
fn index(&self, index: Range<usize>) -> &str
[src]
impl<'a> Index<RangeFrom<usize>> for Text<'a>
[src]
type Output = str
The returned type after indexing.
fn index(&self, index: RangeFrom<usize>) -> &str
[src]
impl<'a> Index<RangeFull> for Text<'a>
[src]
impl<'a> Index<RangeInclusive<usize>> for Text<'a>
[src]
type Output = str
The returned type after indexing.
fn index(&self, index: RangeInclusive<usize>) -> &str
[src]
impl<'a> Index<RangeTo<usize>> for Text<'a>
[src]
type Output = str
The returned type after indexing.
fn index(&self, index: RangeTo<usize>) -> &str
[src]
impl<'a> Index<RangeToInclusive<usize>> for Text<'a>
[src]
type Output = str
The returned type after indexing.
fn index(&self, index: RangeToInclusive<usize>) -> &str
[src]
impl<'a> IndexMut<Range<usize>> for Text<'a>
[src]
impl<'a> IndexMut<RangeFrom<usize>> for Text<'a>
[src]
impl<'a> IndexMut<RangeFull> for Text<'a>
[src]
impl<'a> IndexMut<RangeInclusive<usize>> for Text<'a>
[src]
fn index_mut(&mut self, index: RangeInclusive<usize>) -> &mut str
[src]
impl<'a> IndexMut<RangeTo<usize>> for Text<'a>
[src]
impl<'a> IndexMut<RangeToInclusive<usize>> for Text<'a>
[src]
fn index_mut(&mut self, index: RangeToInclusive<usize>) -> &mut str
[src]
impl<'a> Hash for Text<'a>
[src]
fn hash<H: Hasher>(&self, hasher: &mut H)
[src]
default fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<'a> Clone for Text<'a>
[src]
fn clone(&self) -> Text<'a>
[src]
default fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'a> AsMut<Value<'a>> for Text<'a>
[src]
impl<'a> AsMut<str> for Text<'a>
[src]
impl<'a> AsRef<Value<'a>> for Text<'a>
[src]
impl<'a> AsRef<str> for Text<'a>
[src]
impl<'a> AsRef<[u8]> for Text<'a>
[src]
impl<'a> Holder<'a> for Text<'a>
[src]
impl<'a, 'b> Stow<'b, Text<'b>> for Text<'a>
[src]
unsafe fn stow(
src: *mut Text<'a>,
dst: *mut Text<'b>,
hold: &dyn Hold<'b>
) -> Result<(), HoldError>
[src]
src: *mut Text<'a>,
dst: *mut Text<'b>,
hold: &dyn Hold<'b>
) -> Result<(), HoldError>
unsafe fn unstow(_src: *mut Text<'a>, _dst: *mut Text<'b>)
[src]
impl<'a> TryClone for Text<'a>
[src]
impl<'a, 'b> CloneIntoHold<'a, Text<'a>> for Text<'b>
[src]
fn try_clone_into_hold(
&self,
hold: &dyn Hold<'a>
) -> Result<Text<'a>, HoldError>
[src]
&self,
hold: &dyn Hold<'a>
) -> Result<Text<'a>, HoldError>
default fn clone_into_hold(&self, hold: &dyn Hold<'a>) -> T
[src]
Returns a clone of self
allocated in hold
. Read more
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<'b, S, T> StowFrom for T where
S: Stow<'b, T>,
[src]
S: Stow<'b, T>,
default fn try_stow_from(
src: S,
hold: &dyn Hold<'b>
) -> Result<T, (S, HoldError)>
[src]
src: S,
hold: &dyn Hold<'b>
) -> Result<T, (S, HoldError)>
default fn stow_from(value: T, hold: &dyn Hold<'b>) -> Self
[src]
impl<'b, S, T> StowInto for S where
T: StowFrom<'b, S>,
[src]
T: StowFrom<'b, S>,