Skip to main content

ToOutput

Trait ToOutput 

Source
pub trait ToOutput {
    // Required method
    fn to_output(&self, output: &mut (impl ?Sized + Output));

    // Provided methods
    fn hasher(&self) -> Sha256 { ... }
    fn data_hash(&self) -> Hash { ... }
    fn mangle_hash(&self) -> Hash { ... }
    fn output<T: FromOutput<Output: Default>>(&self) -> T { ... }
    fn vec(&self) -> Vec<u8>  { ... }
}
Expand description

Values of this type can be uniquely represented as a Vec<u8>.

Required Methods§

Source

fn to_output(&self, output: &mut (impl ?Sized + Output))

Provide object’s byte representation to an Output.

Provided Methods§

Source

fn hasher(&self) -> Sha256

Return a Sha256 hasher pre-filled with data of this object.

Source

fn data_hash(&self) -> Hash

[Hash] of (real, i.e. serialized) data of this object.

Source

fn mangle_hash(&self) -> Hash

“Mangle hash” of the object. This is used to introduce runtime distinction between data-identical objects similarly to compile-time Tagged::HASH.

Source

fn output<T: FromOutput<Output: Default>>(&self) -> T

Construct an Output, possibly finalising it afterwards.

For an example of a FromOutput see [Hash].

Source

fn vec(&self) -> Vec<u8>

Collect this object’s data (serialize the object).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ToOutput for ()

Source§

fn to_output(&self, _: &mut (impl ?Sized + Output))

Source§

impl ToOutput for Bytes

Available on crate feature bytes only.
Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for BytesMut

Available on crate feature bytes only.
Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for CStr

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for CString

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for Infallible

Source§

fn to_output(&self, _: &mut (impl ?Sized + Output))

Source§

impl ToOutput for NonZero<i8>

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for NonZero<i16>

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for NonZero<i32>

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for NonZero<i64>

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for NonZero<i128>

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for NonZero<u8>

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for NonZero<u16>

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for NonZero<u32>

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for NonZero<u64>

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for NonZero<u128>

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for Ordering

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for String

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for Ulid

Available on crate feature ulid only.
Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for bool

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for char

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for f32

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for f64

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for i8

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for i16

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for i32

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for i64

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for i128

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for str

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for u8

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for u16

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for u32

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for u64

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl ToOutput for u128

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<'a, B: 'a + ToOwned + ToOutput + ?Sized> ToOutput for Cow<'a, B>

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<A, O: BitOrder> ToOutput for BitArray<A, O>

Available on crate feature bitvec only.
Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<A: InlineOutput, B: InlineOutput, C: InlineOutput, D: InlineOutput, E: InlineOutput, F: InlineOutput, G: InlineOutput, H: InlineOutput, I: InlineOutput, J: InlineOutput, K: InlineOutput, L: ToOutput> ToOutput for (A, B, C, D, E, F, G, H, I, J, K, L)

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<A: InlineOutput, B: InlineOutput, C: InlineOutput, D: InlineOutput, E: InlineOutput, F: InlineOutput, G: InlineOutput, H: InlineOutput, I: InlineOutput, J: InlineOutput, K: ToOutput> ToOutput for (A, B, C, D, E, F, G, H, I, J, K)

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<A: InlineOutput, B: InlineOutput, C: InlineOutput, D: InlineOutput, E: InlineOutput, F: InlineOutput, G: InlineOutput, H: InlineOutput, I: InlineOutput, J: ToOutput> ToOutput for (A, B, C, D, E, F, G, H, I, J)

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<A: InlineOutput, B: InlineOutput, C: InlineOutput, D: InlineOutput, E: InlineOutput, F: InlineOutput, G: InlineOutput, H: InlineOutput, I: ToOutput> ToOutput for (A, B, C, D, E, F, G, H, I)

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<A: InlineOutput, B: InlineOutput, C: InlineOutput, D: InlineOutput, E: InlineOutput, F: InlineOutput, G: InlineOutput, H: ToOutput> ToOutput for (A, B, C, D, E, F, G, H)

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<A: InlineOutput, B: InlineOutput, C: InlineOutput, D: InlineOutput, E: InlineOutput, F: InlineOutput, G: ToOutput> ToOutput for (A, B, C, D, E, F, G)

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<A: InlineOutput, B: InlineOutput, C: InlineOutput, D: InlineOutput, E: InlineOutput, F: ToOutput> ToOutput for (A, B, C, D, E, F)

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<A: InlineOutput, B: InlineOutput, C: InlineOutput, D: InlineOutput, E: ToOutput> ToOutput for (A, B, C, D, E)

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<A: InlineOutput, B: InlineOutput, C: InlineOutput, D: ToOutput> ToOutput for (A, B, C, D)

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<A: InlineOutput, B: InlineOutput, C: ToOutput> ToOutput for (A, B, C)

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<A: InlineOutput, B: ToOutput> ToOutput for (A, B)

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<K: InlineOutput, V: InlineOutput> ToOutput for BTreeMap<K, V>

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<K: InlineOutput, V: InlineOutput> ToOutput for IndexMap<K, V>

Available on crate feature indexmap only.
Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<T: ?Sized + ToOutput> ToOutput for &T

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<T: ?Sized + ToOutput> ToOutput for Arc<T>

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<T: ?Sized + ToOutput> ToOutput for Box<T>

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<T: ?Sized> ToOutput for PhantomData<T>

Source§

fn to_output(&self, _: &mut (impl ?Sized + Output))

Source§

impl<T: InlineOutput, N: ArrayLength> ToOutput for GenericArray<T, N>

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<T: InlineOutput, const N: usize> ToOutput for [T; N]

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<T: InlineOutput> ToOutput for BTreeSet<T>

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<T: InlineOutput> ToOutput for IndexSet<T>

Available on crate feature indexmap only.
Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<T: InlineOutput> ToOutput for Vec<T>

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<T: InlineOutput> ToOutput for VecDeque<T>

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<T: InlineOutput> ToOutput for [T]

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<T: ToOutput> ToOutput for (T,)

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<T> ToOutput for Option<T>
where T: OptionOutput,

Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Source§

impl<T> ToOutput for dyn Send + Sync + ExtraFor<T>

Source§

fn to_output(&self, _: &mut (impl ?Sized + Output))

Source§

impl<const S: usize> ToOutput for CidGeneric<S>

Available on crate feature cid only.
Source§

fn to_output(&self, output: &mut (impl ?Sized + Output))

Implementors§

Source§

impl ToOutput for Address

The only valid connection between an Address and serialisation is in its [Hash].

Source§

impl ToOutput for AddressedBytes

Source§

impl ToOutput for Be<NonZero<i8>>

Source§

impl ToOutput for Be<NonZero<i16>>

Source§

impl ToOutput for Be<NonZero<i32>>

Source§

impl ToOutput for Be<NonZero<i64>>

Source§

impl ToOutput for Be<NonZero<i128>>

Source§

impl ToOutput for Be<NonZero<u8>>

Source§

impl ToOutput for Be<NonZero<u16>>

Source§

impl ToOutput for Be<NonZero<u32>>

Source§

impl ToOutput for Be<NonZero<u64>>

Source§

impl ToOutput for Be<NonZero<u128>>

Source§

impl ToOutput for Be<f32>

Source§

impl ToOutput for Be<f64>

Source§

impl ToOutput for Be<i8>

Source§

impl ToOutput for Be<i16>

Source§

impl ToOutput for Be<i32>

Source§

impl ToOutput for Be<i64>

Source§

impl ToOutput for Be<i128>

Source§

impl ToOutput for Be<u8>

Source§

impl ToOutput for Be<u16>

Source§

impl ToOutput for Be<u32>

Source§

impl ToOutput for Be<u64>

Source§

impl ToOutput for Be<u128>

Source§

impl ToOutput for DiffHashes

Source§

impl ToOutput for Ff

Source§

impl ToOutput for Hash

Source§

impl ToOutput for Le<NonZero<i8>>

Source§

impl ToOutput for Le<NonZero<i16>>

Source§

impl ToOutput for Le<NonZero<i32>>

Source§

impl ToOutput for Le<NonZero<i64>>

Source§

impl ToOutput for Le<NonZero<i128>>

Source§

impl ToOutput for Le<NonZero<u8>>

Source§

impl ToOutput for Le<NonZero<u16>>

Source§

impl ToOutput for Le<NonZero<u32>>

Source§

impl ToOutput for Le<NonZero<u64>>

Source§

impl ToOutput for Le<NonZero<u128>>

Source§

impl ToOutput for Le<f32>

Source§

impl ToOutput for Le<f64>

Source§

impl ToOutput for Le<i8>

Source§

impl ToOutput for Le<i16>

Source§

impl ToOutput for Le<i32>

Source§

impl ToOutput for Le<i64>

Source§

impl ToOutput for Le<i128>

Source§

impl ToOutput for Le<u8>

Source§

impl ToOutput for Le<u16>

Source§

impl ToOutput for Le<u32>

Source§

impl ToOutput for Le<u64>

Source§

impl ToOutput for Le<u128>

Source§

impl ToOutput for LpBytes

Source§

impl ToOutput for LpString

Source§

impl ToOutput for NicheCut

Source§

impl ToOutput for OptionalHash

Source§

impl ToOutput for U63

Source§

impl ToOutput for dyn Resolve + '_

No-op matching the ParseInline.

Source§

impl ToOutput for dyn Singular + '_

Source§

impl<'a, T: ?Sized> ToOutput for WithHash<'a, T>

Source§

impl<A: InlineOutput + Default + PartialEq, B: ToOutput + Default> ToOutput for DefaultChain<A, B>

Source§

impl<A: ToOutput, B: ToOutput> ToOutput for TupleOfArrays<A, B>

Source§

impl<Extra> ToOutput for Extras<Extra>

Source§

impl<Extra> ToOutput for InlineExtra<Extra>
where Extra: ToOutput,

Source§

impl<F> ToOutput for FetchExtra<F>
where F: ToOutput,

Source§

impl<K> ToOutput for PartialByteTag<K>

Source§

impl<M> ToOutput for SmExtra<M>

Source§

impl<T, A: Default + InlineOutput> ToOutput for Dt<T, A>
where for<'a> &'a T: IntoIterator<Item: InlineOutput>,

Source§

impl<T, E> ToOutput for Ent<T, E>
where for<'a> &'a T: EntOutput<E>,

Source§

impl<T, E> ToOutput for ExtraArray<T, E>

Source§

impl<T, Extra> ToOutput for Addressed<T, Extra>

Source§

impl<T, M> ToOutput for MappedExtra<T, M>
where M: InlineOutput, T: ToOutput,

Source§

impl<T, const MAX: usize> ToOutput for EnumTag<T, MAX>
where T: ToOutput,

Source§

impl<T: ?Sized + ToOutput> ToOutput for Mangled<T>

Source§

impl<T: ?Sized> ToOutput for ObjectMarker<T>
where PhantomData<fn() -> T>: ToOutput,

Source§

impl<T: AsRef<str>> ToOutput for NtString<T>

Source§

impl<T: ExtraNoneOutput<E>, E> ToOutput for ExtraOption<T, E>

Source§

impl<T: InlineOutput> ToOutput for LpVec<T>

Source§

impl<T: ListHashes> ToOutput for Hashes<T>

Source§

impl<T: ToOutput> ToOutput for Hashed<T>

Source§

impl<T: ToOutput> ToOutput for Lp<T>

Source§

impl<T: ToOutput> ToOutput for ParseExtra<T>

Source§

impl<T: ToOutput> ToOutput for WithRepr<T>

Source§

impl<T: ToOutput> ToOutput for Zt<T>

Source§

impl<T> ToOutput for AssertRefless<T>
where T: ToOutput,

Source§

impl<T> ToOutput for Local<T>
where T: ToOutput,

Source§

impl<T> ToOutput for Nt<T>
where for<'a> &'a T: IntoIterator, for<'a> Option<<&'a T as IntoIterator>::Item>: InlineOutput,

Source§

impl<T> ToOutput for RuntimeArray<T>
where Vec<T>: ToOutput,

Source§

impl<T> ToOutput for Sequence<T>
where for<'a> &'a T: IntoIterator<Item: InlineOutput>,

Source§

impl<T> ToOutput for dyn Fetch<T = T> + '_

Even though we refer to something, we don’t know [Hash] for it. To match correctness, we don’t implement Parse/ParseInline.

Source§

impl<T> ToOutput for dyn SingularFetch<T = T> + '_