Skip to main content

MaybeAsVarULE

Trait MaybeAsVarULE 

Source
pub trait MaybeAsVarULE {
    type EncodedStruct: ?Sized + VarULE;
}
Expand description

A trait that associates a VarULE type with a data struct.

Some data structs can be represented compactly as a single VarULE, such as str or a packed pattern. This trait allows for data providers to use optimizations for such types.

❗ Not all data structs benefit from this optimization. It works best when the data struct is multiplied across a large number of data marker attributes.

Both MaybeAsVarULE and [MaybeEncodeAsVarULE] should be implemented on all data structs. The data_struct! macro provides an impl.

Required Associated Types§

Source

type EncodedStruct: ?Sized + VarULE

The VarULE type for this data struct, or [()] if it cannot be represented as VarULE.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl MaybeAsVarULE for u16

Source§

impl<'a, V: VarULE + ?Sized> MaybeAsVarULE for VarZeroCow<'a, V>

Source§

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

Implementors§