pub struct BundleScratch { /* private fields */ }Expand description
Enables pushing components to internal scratch space (uses a bump allocator), which can then be written as a dynamic bundle. The contents are cleared after each write and the allocated scratch space is reused across writes.
Also see BundleWriter.
Implementations§
Source§impl BundleScratch
impl BundleScratch
Sourcepub fn writer<'a>(&'a mut self) -> BundleWriter<'a>
pub fn writer<'a>(&'a mut self) -> BundleWriter<'a>
Creates a new BundleWriter using this scratch space. For safety / correctness, this will
clear any existing components.
Note that for performance reasons this will not clear the internal allocator. To avoid leaking,
make sure every component pushed to the BundleWriter is followed by either a
BundleWriter::write or a BundleScratch::manual_drop.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if there are currently no components stored in the scratch space.
Sourcepub unsafe fn manual_drop(&mut self, components: &Components)
pub unsafe fn manual_drop(&mut self, components: &Components)
This will drop all components currently stored in the scratch space. This is generally used to ensure drops occur in error scenarios.
§Safety
components must be from the same world as the components that were pushed to this writer.
Trait Implementations§
Source§impl Default for BundleScratch
impl Default for BundleScratch
Source§fn default() -> BundleScratch
fn default() -> BundleScratch
impl Send for BundleScratch
Auto Trait Implementations§
impl !Freeze for BundleScratch
impl !RefUnwindSafe for BundleScratch
impl !Sync for BundleScratch
impl Unpin for BundleScratch
impl UnsafeUnpin for BundleScratch
impl !UnwindSafe for BundleScratch
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().