pub struct ShortString;Expand description
A inline encoding for a short string. A short string is a UTF-8 encoded string with a maximum length of 32 bytes (inclusive) The string is null-terminated. If the string is shorter than 32 bytes, the remaining bytes are zero. If the string is exactly 32 bytes, then there is no zero terminator.
Trait Implementations§
Source§impl Encodes<&String> for ShortString
impl Encodes<&String> for ShortString
Source§type Output = Inline<ShortString>
type Output = Inline<ShortString>
The concrete form this source produces when encoded for this
schema.
Inline<Self> for inline encodings, Blob<Self> for
blob encodings, or Inline<Handle<Self>> for the
precomputed-handle case where Self: BlobEncoding.Source§impl Encodes<&str> for ShortString
impl Encodes<&str> for ShortString
Source§type Output = Inline<ShortString>
type Output = Inline<ShortString>
The concrete form this source produces when encoded for this
schema.
Inline<Self> for inline encodings, Blob<Self> for
blob encodings, or Inline<Handle<Self>> for the
precomputed-handle case where Self: BlobEncoding.Source§impl Encodes<String> for ShortString
impl Encodes<String> for ShortString
Source§type Output = Inline<ShortString>
type Output = Inline<ShortString>
The concrete form this source produces when encoded for this
schema.
Inline<Self> for inline encodings, Blob<Self> for
blob encodings, or Inline<Handle<Self>> for the
precomputed-handle case where Self: BlobEncoding.Source§impl InlineEncoding for ShortString
impl InlineEncoding for ShortString
Source§type Encoding = ShortString
type Encoding = ShortString
The trait parameter to dispatch via for
entity!{} field
conversion. For inline schemas (32-byte data lives in the
trible), set Encoding = Self — sources convert via
IntoEncoded<Self> { Output = Inline<Self> }. For
Handle<T>, set
Encoding = T — sources convert via IntoEncoded<T> { Output = Blob<T> }. The BlobEncoding T sitting directly at trait
position 0 is what lets downstream impl IntoEncoded<MyBlob> for MyType without bumping into the orphan rule.Source§fn validate(value: Inline<Self>) -> Result<Inline<Self>, Self::ValidationError>
fn validate(value: Inline<Self>) -> Result<Inline<Self>, Self::ValidationError>
Check if the given value conforms to this schema.
Source§fn inline_from<T: IntoInline<Self>>(t: T) -> Inline<Self>
fn inline_from<T: IntoInline<Self>>(t: T) -> Inline<Self>
Create a new value from a concrete Rust type via
IntoInline.
Panics if the underlying conversion panics.Source§fn inline_try_from<T: TryToInline<Self>>(
t: T,
) -> Result<Inline<Self>, <T as TryToInline<Self>>::Error>
fn inline_try_from<T: TryToInline<Self>>( t: T, ) -> Result<Inline<Self>, <T as TryToInline<Self>>::Error>
Create a new value from a concrete Rust type via
TryToInline.
Returns an error if the conversion fails.Source§impl MetaDescribe for ShortString
impl MetaDescribe for ShortString
Source§fn id() -> Id
fn id() -> Id
Returns the id of this type. Default: derive from
Self::describe().root(). Impls choose whether the id is
explicit (an entity!{ &id_hex @ … } form inside describe)
or derived (no @, intrinsic id from the facts) — either
way the default reads the root the fragment carries. Read moreSource§impl<'a> TryFromInline<'a, ShortString> for &'a str
impl<'a> TryFromInline<'a, ShortString> for &'a str
Source§impl<'a> TryFromInline<'a, ShortString> for String
impl<'a> TryFromInline<'a, ShortString> for String
Source§impl TryToInline<ShortString> for &str
impl TryToInline<ShortString> for &str
Source§type Error = FromStrError
type Error = FromStrError
The error type returned when the conversion fails.
Source§fn try_to_inline(self) -> Result<Inline<ShortString>, Self::Error>
fn try_to_inline(self) -> Result<Inline<ShortString>, Self::Error>
Convert the Rust type to a Inline with a specific schema type.
Source§impl TryToInline<ShortString> for String
impl TryToInline<ShortString> for String
Source§type Error = FromStrError
type Error = FromStrError
The error type returned when the conversion fails.
Source§fn try_to_inline(self) -> Result<Inline<ShortString>, Self::Error>
fn try_to_inline(self) -> Result<Inline<ShortString>, Self::Error>
Convert the Rust type to a Inline with a specific schema type.
Auto Trait Implementations§
impl Freeze for ShortString
impl RefUnwindSafe for ShortString
impl Send for ShortString
impl Sync for ShortString
impl Unpin for ShortString
impl UnsafeUnpin for ShortString
impl UnwindSafe for ShortString
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
Source§impl<S> Encodes<&Inline<S>> for Swhere
S: InlineEncoding,
impl<S> Encodes<&Inline<S>> for Swhere
S: InlineEncoding,
Source§impl<S> Encodes<Inline<S>> for Swhere
S: InlineEncoding,
impl<S> Encodes<Inline<S>> for Swhere
S: InlineEncoding,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<S, T> IntoEncoded<S> for Twhere
S: Encodes<T>,
impl<S, T> IntoEncoded<S> for Twhere
S: Encodes<T>,
Source§fn into_encoded(self) -> <T as IntoEncoded<S>>::Output
fn into_encoded(self) -> <T as IntoEncoded<S>>::Output
Run the conversion.