#[non_exhaustive]pub struct TruncatableString {
pub value: String,
pub truncated_byte_count: i32,
}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§
Source§impl TruncatableString
impl TruncatableString
Sourcepub fn set_truncated_byte_count<T: Into<i32>>(self, v: T) -> Self
pub fn set_truncated_byte_count<T: Into<i32>>(self, v: T) -> Self
Sets the value of truncated_byte_count.
Trait Implementations§
Source§impl Clone for TruncatableString
impl Clone for TruncatableString
Source§fn clone(&self) -> TruncatableString
fn clone(&self) -> TruncatableString
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 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<'de> Deserialize<'de> for TruncatableStringwhere
TruncatableString: Default,
impl<'de> Deserialize<'de> for TruncatableStringwhere
TruncatableString: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Message for TruncatableString
impl Message for TruncatableString
Source§impl PartialEq for TruncatableString
impl PartialEq for TruncatableString
Source§impl Serialize for TruncatableString
impl Serialize 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