pub struct LimitedStr<'a>(/* private fields */);
Expand description
Wrapped string to fit TRIMMED_MAX_LEN
amount of bytes.
The Cow
is used to avoid allocating a new String
when the LimitedStr
is
created from a &str
.
Plain str
is not used because it can’t be properly encoded/decoded via scale codec.
Implementations§
Source§impl<'a> LimitedStr<'a>
impl<'a> LimitedStr<'a>
Trait Implementations§
Source§impl<'a> Clone for LimitedStr<'a>
impl<'a> Clone for LimitedStr<'a>
Source§fn clone(&self) -> LimitedStr<'a>
fn clone(&self) -> LimitedStr<'a>
Returns a copy 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<'a> Debug for LimitedStr<'a>
impl<'a> Debug for LimitedStr<'a>
Source§impl<'a> Decode for LimitedStr<'a>
impl<'a> Decode for LimitedStr<'a>
Source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Self, Error>
Attempt to deserialise the value from input.
Source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
Source§impl<'a> Display for LimitedStr<'a>
impl<'a> Display for LimitedStr<'a>
Source§impl<'a> Encode for LimitedStr<'a>
impl<'a> Encode for LimitedStr<'a>
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
Source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Convert self to a slice and append it to the destination.
Source§fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn>(
&self,
f: __CodecUsingEncodedCallback,
) -> __CodecOutputReturn
fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn>( &self, f: __CodecUsingEncodedCallback, ) -> __CodecOutputReturn
Convert self to a slice and then invoke the given closure with it.
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
Source§impl<'a> From<String> for LimitedStr<'a>
impl<'a> From<String> for LimitedStr<'a>
Source§impl<'a> Ord for LimitedStr<'a>
impl<'a> Ord for LimitedStr<'a>
Source§fn cmp(&self, other: &LimitedStr<'a>) -> Ordering
fn cmp(&self, other: &LimitedStr<'a>) -> 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<'a> PartialEq for LimitedStr<'a>
impl<'a> PartialEq for LimitedStr<'a>
Source§impl<'a> PartialOrd for LimitedStr<'a>
impl<'a> PartialOrd for LimitedStr<'a>
Source§impl<'a> TryFrom<&'a str> for LimitedStr<'a>
impl<'a> TryFrom<&'a str> for LimitedStr<'a>
Source§impl<'a> TypeInfo for LimitedStr<'a>where
'a: 'static,
impl<'a> TypeInfo for LimitedStr<'a>where
'a: 'static,
impl<'a> EncodeLike for LimitedStr<'a>
impl<'a> Eq for LimitedStr<'a>
impl<'a> StructuralPartialEq for LimitedStr<'a>
Auto Trait Implementations§
impl<'a> Freeze for LimitedStr<'a>
impl<'a> RefUnwindSafe for LimitedStr<'a>
impl<'a> Send for LimitedStr<'a>
impl<'a> Sync for LimitedStr<'a>
impl<'a> Unpin for LimitedStr<'a>
impl<'a> UnwindSafe for LimitedStr<'a>
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