pub struct StringOwned {
pub(crate) inner: String,
pub(crate) length: Length,
}Expand description
String newtype which respects the Length::max limit.
Fields§
§inner: StringInner value
length: LengthPrecomputed Length (avoids possible panicking conversions)
Implementations§
Source§impl StringOwned
impl StringOwned
Sourcepub fn new(s: String) -> Result<Self>
pub fn new(s: String) -> Result<Self>
Create a new StringOwned, ensuring that the byte representation of
the provided str value is shorter than Length::max().
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
Parse a String from UTF-8 encoded bytes.
Sourcepub fn len(&self) -> Length
pub fn len(&self) -> Length
Get the Length of this StringOwned
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Is this StringOwned empty?
Trait Implementations§
Source§impl AsRef<[u8]> for StringOwned
impl AsRef<[u8]> for StringOwned
Source§impl AsRef<BytesRef> for StringOwned
impl AsRef<BytesRef> for StringOwned
Source§impl AsRef<StringRef> for StringOwned
impl AsRef<StringRef> for StringOwned
Source§impl AsRef<str> for StringOwned
impl AsRef<str> for StringOwned
Source§impl Borrow<StringRef> for StringOwned
impl Borrow<StringRef> for StringOwned
Source§impl Clone for StringOwned
impl Clone for StringOwned
Source§fn clone(&self) -> StringOwned
fn clone(&self) -> StringOwned
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StringOwned
impl Debug for StringOwned
Source§impl<'a> DecodeValue<'a> for StringOwned
impl<'a> DecodeValue<'a> for StringOwned
Source§impl Deref for StringOwned
impl Deref for StringOwned
Source§impl EncodeValue for StringOwned
impl EncodeValue for StringOwned
Source§impl Hash for StringOwned
impl Hash for StringOwned
Source§impl Ord for StringOwned
impl Ord for StringOwned
Source§fn cmp(&self, other: &StringOwned) -> Ordering
fn cmp(&self, other: &StringOwned) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for StringOwned
impl PartialEq for StringOwned
Source§impl PartialOrd for StringOwned
impl PartialOrd for StringOwned
impl Eq for StringOwned
impl StructuralPartialEq for StringOwned
Auto Trait Implementations§
impl Freeze for StringOwned
impl RefUnwindSafe for StringOwned
impl Send for StringOwned
impl Sync for StringOwned
impl Unpin for StringOwned
impl UnsafeUnpin for StringOwned
impl UnwindSafe for StringOwned
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