pub struct SceneBuilder<'a> { /* private fields */ }
Expand description
Builder for Scene
.
Implementations§
Source§impl<'a> SceneBuilder<'a>
impl<'a> SceneBuilder<'a>
Sourcepub fn with_game_object_type<G: GameObject>(
&'a mut self,
count: usize,
) -> SceneBuilder<'a>
pub fn with_game_object_type<G: GameObject>( &'a mut self, count: usize, ) -> SceneBuilder<'a>
Adds G
as a game object type and reserves space for a maximum of
count
game objects at a time.
Source§impl SceneBuilder<'_>
impl SceneBuilder<'_>
Sourcepub fn build<'a>(
self,
arena: &'a LinearAllocator<'_>,
temp_arena: &LinearAllocator<'_>,
) -> Option<Scene<'a>>
pub fn build<'a>( self, arena: &'a LinearAllocator<'_>, temp_arena: &LinearAllocator<'_>, ) -> Option<Scene<'a>>
Allocates memory for and creates a Scene
, if arena
has enough
memory for it.
The memory requirement of a Scene
is the sum of each component’s
size times how many game objects have that component, and possibly
padding bytes between the per-component allocations. Allocations are
done on a per-component basis, so multiple game objects using component
A will simply result in one large allocation for component A that can
fit all of those game objects’ components.
The temp_arena
allocator is used for small allocations of about 100
bytes per component, and can be reset after this function is done.
Auto Trait Implementations§
impl<'a> Freeze for SceneBuilder<'a>
impl<'a> RefUnwindSafe for SceneBuilder<'a>
impl<'a> Send for SceneBuilder<'a>
impl<'a> Sync for SceneBuilder<'a>
impl<'a> Unpin for SceneBuilder<'a>
impl<'a> UnwindSafe for SceneBuilder<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more