Struct App
pub struct App { /* private fields */ }Implementations§
§impl App
impl App
pub fn new(resources: Resources) -> Self
pub fn new(resources: Resources) -> Self
Creates a new standalone application with the given resources.
pub fn run<T: 'static>(self, event_loop: EventLoop<T>) -> AppExit
pub fn resources_mut(&mut self) -> &mut Resources
pub fn resources_mut(&mut self) -> &mut Resources
Returns a mutable reference to the application’s resources.
pub fn into_resources(self) -> Resources
pub fn into_resources(self) -> Resources
returns the owned resources from the application.
pub fn should_exit(&self) -> Option<AppExit>
Methods from Deref<Target = Resources>§
pub fn init_event<T>(&mut self) -> ResourceId<Events<T>>
pub fn init_meta<M, R>(&mut self)where
R: 'static,
M: AnyCastMut<R> + 'static + ?Sized,
pub fn init_meta_readonly<M, R>(&mut self)
pub fn init_meta_id<M, R>(&mut self, id: ResourceId<R>)where
R: 'static,
M: AnyCastMut<R> + 'static + ?Sized,
pub fn init_meta_readonly_id<M, R>(&mut self, id: ResourceId<R>)
pub fn foreach_meta<T>(&self, f: impl FnMut(&T))where
T: 'static + ?Sized,
pub fn foreach_meta_mut<T>(&self, f: impl FnMut(&mut T))where
T: 'static + ?Sized,
pub fn install<M>(&mut self, module: M) -> boolwhere
M: Module,
pub fn as_send(&self) -> &ResourcesSend
pub fn insert<T>(&mut self, value: T) -> ResourceId<T>
pub fn insert_box<T>(&mut self, value: Box<T>) -> ResourceId<T>
pub fn define<T>(&mut self) -> ResourceId<T>
pub fn insert_unsend<T>(&mut self, value: T) -> ResourceId<T>where
T: 'static,
pub fn insert_box_unsend<T>(&mut self, value: Box<T>) -> ResourceId<T>where
T: 'static,
pub fn define_unsend<T>(&mut self) -> ResourceId<T>where
T: 'static,
pub fn try_init<T>(&mut self) -> Result<ResourceId<T>, ResourceId<T>>
pub fn init<T>(&mut self) -> ResourceId<T>
pub fn try_init_unsend<T>(&mut self) -> Result<ResourceId<T>, ResourceId<T>>where
T: FromResourcesMut + 'static,
pub fn init_unsend<T>(&mut self) -> ResourceId<T>where
T: FromResourcesMut + 'static,
pub fn clear(&mut self)
pub fn borrow_res<T>(&self) -> Option<AtomicRef<'_, T>>where
T: 'static,
pub fn borrow_res_id<T>(
&self,
resource_id: ResourceId<T>,
) -> Option<AtomicRef<'_, T>>where
T: 'static,
pub fn borrow_res_mut<T>(&self) -> Option<AtomicRefMut<'_, T>>where
T: 'static,
pub fn borrow_res_mut_id<T>(
&self,
resource_id: ResourceId<T>,
) -> Option<AtomicRefMut<'_, T>>where
T: 'static,
pub fn get_mut<T>(&mut self) -> Option<&mut T>where
T: 'static,
pub fn get_mut_id<T>(&mut self, resource_id: ResourceId<T>) -> Option<&mut T>where
T: 'static,
pub fn get_copy<T>(&self) -> Option<T>where
T: Copy + 'static,
pub fn get_copy_id<T>(&self, resource_id: ResourceId<T>) -> Option<T>where
T: Copy + 'static,
pub fn get_clone<T>(&self) -> Option<T>where
T: Clone + 'static,
pub fn get_clone_id<T>(&self, resource_id: ResourceId<T>) -> Option<T>where
T: Clone + 'static,
pub fn take<T>(&mut self) -> Option<Taken<T>>where
T: 'static,
pub fn take_id<T>(&mut self, resource_id: ResourceId<T>) -> Option<Taken<T>>where
T: 'static,
pub fn put_back<T>(&mut self, taken: Taken<T>)where
T: 'static,
pub fn take_and<T, R>(
&mut self,
f: impl FnOnce(&mut T, &mut Resources) -> R,
) -> Option<R>where
T: 'static,
pub fn take_id_and<T, R>(
&mut self,
resource_id: ResourceId<T>,
f: impl FnOnce(&mut T, &mut Resources) -> R,
) -> Option<R>where
T: 'static,
pub fn borrow_res_meta<T>(
&self,
resource_id: ResourceId<T>,
) -> Option<AtomicRef<'_, T>>where
T: 'static + ?Sized,
pub fn borrow_res_any( &self, resource_id: ResourceId, ) -> Option<AtomicRef<'_, dyn Any + 'static>>
pub fn borrow_res_mut_meta<T>(
&self,
resource_id: ResourceId<T>,
) -> Option<AtomicRefMut<'_, T>>where
T: 'static + ?Sized,
pub fn borrow_res_any_mut( &self, resource_id: ResourceId, ) -> Option<AtomicRefMut<'_, dyn Any + 'static>>
pub fn get_mut_any( &mut self, resource_id: ResourceId, ) -> Option<&mut (dyn Any + 'static)>
pub fn run_schedule<S>(&mut self)
pub fn run_schedule_id<S>(&mut self, id: ResourceId<S>)
Methods from Deref<Target = ResourcesSend>§
Sourcepub unsafe fn as_unsend(&self) -> &Resources
pub unsafe fn as_unsend(&self) -> &Resources
§Safety
User must not access unsend resources in other threads.
pub fn id<T>(&self) -> Option<ResourceId<T>>where
T: 'static,
pub fn expect_id<T>(&self) -> ResourceId<T>where
T: 'static,
pub fn name<T>(&self, id: ResourceId<T>) -> Option<&str>
pub fn type_id<T>(&self, id: ResourceId<T>) -> Option<TypeId>
pub fn borrow_res<T>(&self) -> Option<AtomicRef<'_, T>>
pub fn borrow_res_id<T>( &self, resource_id: ResourceId<T>, ) -> Option<AtomicRef<'_, T>>
pub fn borrow_res_mut<T>(&self) -> Option<AtomicRefMut<'_, T>>
pub fn borrow_res_mut_id<T>( &self, resource_id: ResourceId<T>, ) -> Option<AtomicRefMut<'_, T>>
pub fn get_copy<T>(&self) -> Option<T>
pub fn get_copy_id<T>(&self, resource_id: ResourceId<T>) -> Option<T>
pub fn get_clone<T>(&self) -> Option<T>
pub fn get_clone_id<T>(&self, resource_id: ResourceId<T>) -> Option<T>
Trait Implementations§
§impl<T: 'static> ApplicationHandler<T> for App
impl<T: 'static> ApplicationHandler<T> for App
§fn new_events(&mut self, event_loop: &ActiveEventLoop, cause: StartCause)
fn new_events(&mut self, event_loop: &ActiveEventLoop, cause: StartCause)
Emitted when new events arrive from the OS to be processed. Read more
§fn resumed(&mut self, event_loop: &ActiveEventLoop)
fn resumed(&mut self, event_loop: &ActiveEventLoop)
Emitted when the application has been resumed. Read more
§fn window_event(
&mut self,
event_loop: &ActiveEventLoop,
window_id: WindowId,
event: WindowEvent,
)
fn window_event( &mut self, event_loop: &ActiveEventLoop, window_id: WindowId, event: WindowEvent, )
Emitted when the OS sends an event to a winit window.
§fn user_event(&mut self, event_loop: &ActiveEventLoop, event: T)
fn user_event(&mut self, event_loop: &ActiveEventLoop, event: T)
Emitted when an event is sent from
EventLoopProxy::send_event.§fn device_event(
&mut self,
event_loop: &ActiveEventLoop,
device_id: DeviceId,
event: DeviceEvent,
)
fn device_event( &mut self, event_loop: &ActiveEventLoop, device_id: DeviceId, event: DeviceEvent, )
Emitted when the OS sends an event to a device.
§fn suspended(&mut self, event_loop: &ActiveEventLoop)
fn suspended(&mut self, event_loop: &ActiveEventLoop)
Emitted when the application has been suspended. Read more
§fn exiting(&mut self, event_loop: &ActiveEventLoop)
fn exiting(&mut self, event_loop: &ActiveEventLoop)
Emitted when the event loop is being shut down. Read more
§fn about_to_wait(&mut self, event_loop: &ActiveEventLoop)
fn about_to_wait(&mut self, event_loop: &ActiveEventLoop)
Emitted when the event loop is about to block and wait for new events. Read more
Source§fn memory_warning(&mut self, event_loop: &ActiveEventLoop)
fn memory_warning(&mut self, event_loop: &ActiveEventLoop)
Emitted when the application has received a memory warning. Read more
Auto Trait Implementations§
impl Freeze for App
impl !RefUnwindSafe for App
impl !Send for App
impl !Sync for App
impl Unpin for App
impl !UnwindSafe for App
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
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.