pub struct IsoString<C: Charset> { /* private fields */ }Available on crate feature
alloc only.Expand description
A dynamically-sized ISO string (requires alloc feature)
Implementations§
Source§impl<C: Charset> IsoString<C>
impl<C: Charset> IsoString<C>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Performs the with_capacity operation.
Sourcepub fn from_bytes(bytes: &[u8]) -> Self
pub fn from_bytes(bytes: &[u8]) -> Self
Performs the from_bytes operation.
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Borrow the contents as a &str.
§Panics
Panics if the bytes are not valid UTF-8. IsoString accepts arbitrary
bytes via Self::from_bytes / From<Vec<u8>>, so the buffer is not
guaranteed to be UTF-8. Use Self::try_as_str for a fallible
variant.
Sourcepub fn try_as_str(&self) -> Result<&str, Utf8Error>
pub fn try_as_str(&self) -> Result<&str, Utf8Error>
Borrow the contents as a &str if they are valid UTF-8.
Trait Implementations§
impl<C: Eq + Charset> Eq for IsoString<C>
impl<C: PartialEq + Charset> StructuralPartialEq for IsoString<C>
Auto Trait Implementations§
impl<C> Freeze for IsoString<C>where
PhantomData<C>: Freeze,
impl<C> RefUnwindSafe for IsoString<C>where
PhantomData<C>: RefUnwindSafe,
impl<C> Send for IsoString<C>where
PhantomData<C>: Send,
impl<C> Sync for IsoString<C>where
PhantomData<C>: Sync,
impl<C> Unpin for IsoString<C>where
PhantomData<C>: Unpin,
impl<C> UnsafeUnpin for IsoString<C>where
PhantomData<C>: UnsafeUnpin,
impl<C> UnwindSafe for IsoString<C>where
PhantomData<C>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more