#[repr(transparent)]pub struct StringRef(str);Expand description
String slice newtype which respects the Length::max limit.
Tuple Fields§
§0: strImplementations§
Source§impl StringRef
impl StringRef
Sourcepub const fn new(s: &str) -> Result<&Self>
pub const fn new(s: &str) -> Result<&Self>
Create a new StringRef, ensuring that the byte representation of
the provided str value is shorter than Length::max().
Sourcepub(crate) const fn new_unchecked(s: &str) -> &Self
pub(crate) const fn new_unchecked(s: &str) -> &Self
Perform a raw conversion of a str to Self without first performing a length check.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<&Self>
pub fn from_bytes(bytes: &[u8]) -> Result<&Self>
Parse a StringRef from UTF-8 encoded bytes.
Trait Implementations§
Source§impl AsRef<StringRef> for StringOwned
impl AsRef<StringRef> for StringOwned
Source§impl Borrow<StringRef> for StringOwned
impl Borrow<StringRef> for StringOwned
Source§impl<'a> DecodeValue<'a> for &'a StringRef
impl<'a> DecodeValue<'a> for &'a StringRef
Source§impl EncodeValue for StringRef
impl EncodeValue for StringRef
impl Eq for StringRef
Source§impl PartialOrd for StringRef
impl PartialOrd for StringRef
impl StructuralPartialEq for StringRef
Source§impl ToOwned for StringRef
impl ToOwned for StringRef
Source§type Owned = StringOwned
type Owned = StringOwned
The resulting type after obtaining ownership.
Source§fn to_owned(&self) -> StringOwned
fn to_owned(&self) -> StringOwned
Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · Source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
Uses borrowed data to replace owned data, usually by cloning. Read more