pub trait Encodes<Source> {
type Output;
// Required method
fn encode(source: Source) -> Self::Output;
}Expand description
User-implemented schema-side encoding trait, in the From
direction: the schema is the impl target, the source is the
trait parameter.
impl Encodes<&str> for LongString {
type Output = Blob<LongString>;
fn encode(s: &str) -> Blob<LongString> { Blob::new(s.into()) }
}This is the canonical orphan-rule shape (mirroring From<T> in
std): downstream that defines a local MyBlobEncoding writes
impl Encodes<ForeignType> for MyBlobEncoding — the local encoding
sits at the impl-target position so Rust’s orphan checker
trivially accepts the impl, no matter how foreign the source
type is.
The user-facing source-side ergonomic — source.into_encoded() /
source.to_inline() / source.to_blob() — is blanket-derived
from this trait via IntoEncoded.
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
Source§impl Encodes<&'static str> for LongString
impl Encodes<&'static str> for LongString
type Output = Blob<LongString>
Source§impl Encodes<&str> for ShortString
impl Encodes<&str> for ShortString
type Output = Inline<ShortString>
Source§impl Encodes<&TribleSet> for SimpleArchive
impl Encodes<&TribleSet> for SimpleArchive
type Output = Blob<SimpleArchive>
Source§impl Encodes<&String> for ShortString
impl Encodes<&String> for ShortString
type Output = Inline<ShortString>
Source§impl Encodes<(u128, u128)> for RangeInclusiveU128
impl Encodes<(u128, u128)> for RangeInclusiveU128
type Output = Inline<RangeInclusiveU128>
Source§impl Encodes<i128> for NsDuration
impl Encodes<i128> for NsDuration
type Output = Inline<NsDuration>
Source§impl Encodes<Bytes> for UnknownBlob
impl Encodes<Bytes> for UnknownBlob
type Output = Blob<UnknownBlob>
Source§impl Encodes<TribleSet> for SimpleArchive
impl Encodes<TribleSet> for SimpleArchive
type Output = Blob<SimpleArchive>
Source§impl Encodes<VerifyingKey> for ED25519PublicKey
impl Encodes<VerifyingKey> for ED25519PublicKey
type Output = Inline<ED25519PublicKey>
Source§impl Encodes<String> for LongString
impl Encodes<String> for LongString
type Output = Blob<LongString>
Source§impl Encodes<String> for ShortString
impl Encodes<String> for ShortString
type Output = Inline<ShortString>
Source§impl Encodes<Span> for LineLocation
impl Encodes<Span> for LineLocation
type Output = Inline<LineLocation>
Source§impl Encodes<Signature> for ED25519RComponent
impl Encodes<Signature> for ED25519RComponent
type Output = Inline<ED25519RComponent>
Source§impl Encodes<Signature> for ED25519SComponent
impl Encodes<Signature> for ED25519SComponent
type Output = Inline<ED25519SComponent>
Source§impl Encodes<Duration> for NsDuration
impl Encodes<Duration> for NsDuration
type Output = Inline<NsDuration>
Source§impl<S: BlobEncoding> Encodes<Blob<S>> for Swhere
Handle<S>: InlineEncoding,
Blob<S> is the identity source for [IntoEncoded<S>] in the
blob path: it converts to itself with no allocation, and the
cached handle inside lets every downstream step skip rehashing.
impl<S: BlobEncoding> Encodes<Blob<S>> for Swhere
Handle<S>: InlineEncoding,
Blob<S> is the identity source for [IntoEncoded<S>] in the
blob path: it converts to itself with no allocation, and the
cached handle inside lets every downstream step skip rehashing.
Source§impl<T: ArrayElement> Encodes<Vec<<T as ArrayElement>::Native>> for Array<T>
Store a Vec<T::Native> as an Array<T> blob (zero-copy via ByteSource).
impl<T: ArrayElement> Encodes<Vec<<T as ArrayElement>::Native>> for Array<T>
Store a Vec<T::Native> as an Array<T> blob (zero-copy via ByteSource).
Source§impl<T: BlobEncoding> Encodes<&Inline<Handle<T>>> for Twhere
Handle<T>: InlineEncoding,
Reference form of the precomputed-handle case.
impl<T: BlobEncoding> Encodes<&Inline<Handle<T>>> for Twhere
Handle<T>: InlineEncoding,
Reference form of the precomputed-handle case.
Source§impl<T: BlobEncoding> Encodes<Inline<Handle<T>>> for Twhere
Handle<T>: InlineEncoding,
Precomputed-handle case: a Inline<Handle<T>> can be passed as a
IntoEncoded<T> source (T is the BlobEncoding, matching the
Handle<T>-attributed field’s Encoding). Output is the value
itself; no side-blob — caller asserts the bytes live somewhere
resolvable.
impl<T: BlobEncoding> Encodes<Inline<Handle<T>>> for Twhere
Handle<T>: InlineEncoding,
Precomputed-handle case: a Inline<Handle<T>> can be passed as a
IntoEncoded<T> source (T is the BlobEncoding, matching the
Handle<T>-attributed field’s Encoding). Output is the value
itself; no side-blob — caller asserts the bytes live somewhere
resolvable.