pub trait StringType: Sealed + Into<String> {
// Required methods
fn as_bytes(&self) -> &[u8];
fn is_allocated(&self) -> bool;
fn is_empty(&self) -> bool;
fn len(&self) -> usize;
}
Available on crate feature
alloc
only.Expand description
Trait for standard utf-8 string types. Implemented for &str
, String
, Box<str>
and Cow<'_, str>
Required Methods§
Sourcefn is_allocated(&self) -> bool
fn is_allocated(&self) -> bool
Check if the string is allocated
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.