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§
Sourcefn read(&mut self) -> Result<(World, Report)>
fn read(&mut self) -> Result<(World, Report)>
The world to plan from: placements, prototypes and their state; geometry and textures not loaded yet.
Sourcefn load(
&mut self,
world: &World,
roots: &BTreeSet<Entity>,
) -> Result<(World, Report)>
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.
Sourcefn emits(&self) -> &'static [&'static str]
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.
Provided Methods§
Sourcefn scope_spec(&self) -> Option<&'static ReadScopeSpec>
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.
Sourcefn read_scope(&self) -> Option<ReadScope>
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.
Sourcefn load_all(&mut self, world: World) -> Result<(World, Report)>
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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".