pub struct Module<T> {
pub inner: Rc<Inner<T>>,
}Expand description
A cheaply-clonable, reference-counted handle to a registered module.
Fields§
§inner: Rc<Inner<T>>Shared inner state holding the module and its metadata.
Implementations§
Source§impl<T> Module<T>where
T: App + 'static,
impl<T> Module<T>where
T: App + 'static,
Sourcepub fn any(&self) -> Rc<RefCell<dyn ModuleT<Context = T>>>
pub fn any(&self) -> Rc<RefCell<dyn ModuleT<Context = T>>>
Returns a cloned reference-counted handle to the inner type-erased module.
Sourcepub fn main(&self, core: &mut T)
pub fn main(&self, core: &mut T)
Runs the module’s main update step, invoking its ModuleT::main hook.
Sourcepub fn activate(&self, core: &mut T)
pub fn activate(&self, core: &mut T)
Activates the module, invoking its ModuleT::activate hook.
Sourcepub fn deactivate(&self, core: &mut T)
pub fn deactivate(&self, core: &mut T)
Deactivates the module, invoking its ModuleT::deactivate hook.
Sourcepub fn render(
&self,
core: &mut T,
ctx: &Context,
frame: &mut Frame,
ui: &mut Ui,
)
pub fn render( &self, core: &mut T, ctx: &Context, frame: &mut Frame, ui: &mut Ui, )
Applies the module’s style (mobile or default text styles) and then renders the module’s UI.
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Returns the module’s display name, falling back to the derived type name when the module does not provide its own.
Trait Implementations§
impl<T> Eq for Module<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Module<T>
impl<T> !Send for Module<T>
impl<T> !Sync for Module<T>
impl<T> !UnwindSafe for Module<T>
impl<T> Freeze for Module<T>
impl<T> Unpin for Module<T>
impl<T> UnsafeUnpin for Module<T>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<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>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> 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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.