Skip to main content

AnyReader

Trait AnyReader 

Source
pub trait AnyReader<'a>: Sized {
    const TYPE_ID: u64;
    const LEAF_COUNT: usize;

    // Required method
    fn from_use_site(
        reader: StructReader<'a>,
        offsets: &'a [u32],
        discriminant_offset: u32,
    ) -> Self;
}
Expand description

The reader every group or union type newtype generates: one type that reads the newtype at any of its use sites.

Inlining lets each struct place a newtype’s members wherever they fit, so a use site is described by the parent’s raw reader plus an offset table saying where each member lives. Typed code gets one from a use site’s as_any(). Dynamic code gets one with dynamic_value::Reader::downcast::<vec3::AnyReader>() on the group, which reads the same table from the schema.

Required Associated Constants§

Source

const TYPE_ID: u64

The id of the type declaration this reads (not of an alias of it).

Source

const LEAF_COUNT: usize

How many entries a use site’s offset table has.

Required Methods§

Source

fn from_use_site( reader: StructReader<'a>, offsets: &'a [u32], discriminant_offset: u32, ) -> Self

Builds the reader over one use site. discriminant_offset is used only by union newtypes. Generated code and downcast call this; other code normally doesn’t.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§