Skip to main content

Reader

Trait Reader 

Source
pub trait Reader {
    // Required methods
    fn read(&mut self) -> Result<(World, Report)>;
    fn load(
        &mut self,
        world: &World,
        roots: &BTreeSet<Entity>,
    ) -> Result<(World, Report)>;
    fn emits(&self) -> &'static [&'static str];
    fn prototype_box(
        &self,
        world: &World,
        prototype: Entity,
    ) -> Option<[[f64; 3]; 2]>;

    // Provided methods
    fn scope_spec(&self) -> Option<&'static ReadScopeSpec> { ... }
    fn read_scope(&self) -> Option<ReadScope> { ... }
    fn load_all(&mut self, world: World) -> Result<(World, Report)> { ... }
    fn notices(&mut self) -> Vec<Notice> { ... }
}
Expand description

A source of worlds: the world to plan from, then the parts asked for, loaded.

Required Methods§

Source

fn read(&mut self) -> Result<(World, Report)>

The world to plan from: placements, prototypes and their state; geometry and textures not loaded yet.

Source

fn load( &mut self, world: &World, roots: &BTreeSet<Entity>, ) -> Result<(World, Report)>

The subset of world that roots reach, with everything a writer needs loaded (meshes, textures); entity ids stay world’s, and what loading spawns is reached through the roots.

Source

fn emits(&self) -> &'static [&'static str]

The component namespaces it may put in a world (core, its own dialect): a reader reads, it lowers nothing (no pbr.* unless its source format is PBR). check_emits holds it to that after reading, and check_load_emits holds what each load adds to it.

Source

fn prototype_box( &self, world: &World, prototype: Entity, ) -> Option<[[f64; 3]; 2]>

A prototype’s box (core frame) before its geometry is loaded, where the reader knows it.

Provided Methods§

Source

fn scope_spec(&self) -> Option<&'static ReadScopeSpec>

Optional declaration of this reader’s caller-stated loading scope. The declaration reuses pass options and supplies no default for a required scope choice.

Source

fn read_scope(&self) -> Option<ReadScope>

Effective checked scope, including source alternatives left unloaded. A scoped reader also retains it in crate::read_scope::ReadScopes and reports its selection notice.

Source

fn load_all(&mut self, world: World) -> Result<(World, Report)>

Reader::load of every entity of world, which it takes: the loaded world of a program that wants the whole source. The default is that load, so world and the world it returns are alive together; a reader whose load copies what it keeps overrides this to load world in place, and the source is held once.

Source

fn notices(&mut self) -> Vec<Notice>

What it noticed since it was last asked (source it can’t read, what it tolerated), taken after reading and after each load. None by default.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§