pub struct ResourceHandles { /* private fields */ }Expand description
Per-kind handles assigned to each resource, keyed by its identity.
Implementations§
Source§impl ResourceHandles
impl ResourceHandles
Sourcepub fn assign(&mut self, kind: ResourceKind, id: AssetId) -> u32
pub fn assign(&mut self, kind: ResourceKind, id: AssetId) -> u32
Give one resource the next handle in its kind’s space and record it.
Declaration order in, dense 0..N out.
Sourcepub fn get(&self, kind: ResourceKind, id: AssetId) -> Option<u32>
pub fn get(&self, kind: ResourceKind, id: AssetId) -> Option<u32>
The handle a resource received, if it was assigned one.
Sourcepub fn count(&self, kind: ResourceKind) -> u32
pub fn count(&self, kind: ResourceKind) -> u32
How many handles a kind has assigned: its table length.
Sourcepub fn from_assets(
assets: impl IntoIterator<Item = (AssetId, ResourceKind)>,
) -> Self
pub fn from_assets( assets: impl IntoIterator<Item = (AssetId, ResourceKind)>, ) -> Self
Assign handles across a world’s resources, in the order given. The caller has already classified each asset and passes only the resources; each kind counts independently from zero.
Sourcepub fn assign_mesh_sources(
&mut self,
sources: impl IntoIterator<Item = (AssetId, MeshBlock)>,
)
pub fn assign_mesh_sources( &mut self, sources: impl IntoIterator<Item = (AssetId, MeshBlock)>, )
Assign the shared mesh-source handle space over a world’s geometry producers, given in declaration order with the block each belongs to. Handles go out in block order, declaration order within a block.
Sourcepub fn assign_shader(&mut self, id: AssetId) -> u32
pub fn assign_shader(&mut self, id: AssetId) -> u32
Give one Shader the next handle in the shader space and record it.
Sourcepub fn shader(&self, id: AssetId) -> Option<u32>
pub fn shader(&self, id: AssetId) -> Option<u32>
The handle a Shader received, if it was assigned one.
Sourcepub fn shader_count(&self) -> u32
pub fn shader_count(&self) -> u32
How many shader handles were assigned.
Trait Implementations§
Source§impl Clone for ResourceHandles
impl Clone for ResourceHandles
Source§fn clone(&self) -> ResourceHandles
fn clone(&self) -> ResourceHandles
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more