pub struct MeshBox { /* private fields */ }Expand description
A type-erased container for storing any type that implements MeshLike.
Similar to Box<dyn Any>.
Implementations§
Source§impl MeshBox
impl MeshBox
pub fn new<M: MeshLike + 'static>(mesh: M) -> Self
Sourcepub fn downcast_ref<M: MeshLike + 'static>(&self) -> Option<&M>
pub fn downcast_ref<M: MeshLike + 'static>(&self) -> Option<&M>
Attempts to downcast the stored mesh to a reference of given type M.
Returns Some(&M) if the types match, None otherwise.
Sourcepub fn downcast_ref_unchecked<M: MeshLike + 'static>(&self) -> &M
pub fn downcast_ref_unchecked<M: MeshLike + 'static>(&self) -> &M
Downcasts the stored mesh to a reference of type M without type checking.
§Safety
Caller must ensure the stored mesh is actually of type M.
Incorrect usage leads to undefined behavior.
Sourcepub fn downcast_mut<M: MeshLike + 'static>(&mut self) -> Option<&mut M>
pub fn downcast_mut<M: MeshLike + 'static>(&mut self) -> Option<&mut M>
Attempts to downcast the stored mesh to a mutable reference of given type M.
Returns Some(&mut M) if the types match, None otherwise.
Sourcepub fn downcast_mut_unchecked<M: MeshLike + 'static>(&mut self) -> &mut M
pub fn downcast_mut_unchecked<M: MeshLike + 'static>(&mut self) -> &mut M
Downcasts the stored mesh to a mutable reference of type M without type checking.
§Safety
Caller must ensure the stored mesh is actually of type M.
Incorrect usage leads to undefined behavior.
Sourcepub fn update_mesh(&mut self)
pub fn update_mesh(&mut self)
Triggers MeshLike::update for the stored mesh.
Sourcepub fn update_instance(&mut self, instance: &mut RenderInstance)
pub fn update_instance(&mut self, instance: &mut RenderInstance)
Triggers [InstanceUpdater::update_instance] for the stored mesh.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MeshBox
impl RefUnwindSafe for MeshBox
impl !Send for MeshBox
impl !Sync for MeshBox
impl Unpin for MeshBox
impl UnsafeUnpin for MeshBox
impl UnwindSafe for MeshBox
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.