#[non_exhaustive]pub struct TruncatableString {
pub value: String,
pub truncated_byte_count: i32,
/* private fields */
}Expand description
Represents a string that might be shortened to a specified length.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.value: StringThe shortened string. For example, if the original string is 500
bytes long and the limit of the string is 128 bytes, then
value contains the first 128 bytes of the 500-byte string.
Truncation always happens on a UTF8 character boundary. If there are multi-byte characters in the string, then the length of the shortened string might be less than the size limit.
truncated_byte_count: i32The number of bytes removed from the original string. If this value is 0, then the string was not shortened.
Implementations§
Trait Implementations§
Source§impl Clone for TruncatableString
impl Clone for TruncatableString
Source§fn clone(&self) -> TruncatableString
fn clone(&self) -> TruncatableString
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 TruncatableString
impl Debug for TruncatableString
Source§impl Default for TruncatableString
impl Default for TruncatableString
Source§fn default() -> TruncatableString
fn default() -> TruncatableString
Returns the “default value” for a type. Read more
Source§impl Message for TruncatableString
impl Message for TruncatableString
Source§impl PartialEq for TruncatableString
impl PartialEq for TruncatableString
impl StructuralPartialEq for TruncatableString
Auto Trait Implementations§
impl Freeze for TruncatableString
impl RefUnwindSafe for TruncatableString
impl Send for TruncatableString
impl Sync for TruncatableString
impl Unpin for TruncatableString
impl UnwindSafe for TruncatableString
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