Struct Args

Source
#[non_exhaustive]
pub struct Args<'a, A: Application> { pub window: &'a mut MainWindowWithRenderer, pub event_loop: &'a ActiveEventLoop, pub event_proxy: &'a EventLoopProxy<AppEvent<A>>, pub data: &'a mut A::Data, }
Expand description

This type is an aggregate of values retured by AppHandler.

With this you don’t need to have a buch of use that you probably don’t care about.

Since this is not Send it is always used from the main loop, and it can be used to send non Send callbacks to the idle loop.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§window: &'a mut MainWindowWithRenderer

The main window.

§event_loop: &'a ActiveEventLoop

The event loop.

§event_proxy: &'a EventLoopProxy<AppEvent<A>>

A proxy to send messages to the main loop.

§data: &'a mut A::Data

The custom application data.

Implementations§

Source§

impl<A: Application> Args<'_, A>

Source

pub fn local_proxy(&self) -> LocalProxy<A>

Creates a LocalProxy that is Clone but not Send.

Source

pub fn ping_user_input(&mut self)

Helper function to call ping_user_input in the main window.

Source

pub fn spawn_idle<T: 'static, F: Future<Output = T> + 'static>( &self, f: F, ) -> FutureHandle<T>

Registers a future to be run during the idle step of the main loop.

Source

pub fn run_idle<F: FnOnce(&mut A, Args<'_, A>) + 'static>( &self, f: F, ) -> Result<(), EventLoopClosed<()>>

Registers a callback to be called during the idle step of the main loop.

Source

pub fn future_back(&self) -> FutureBackCaller<A>

Creates a FutureBackCaller for this application.

Auto Trait Implementations§

§

impl<'a, A> Freeze for Args<'a, A>

§

impl<'a, A> !RefUnwindSafe for Args<'a, A>

§

impl<'a, A> !Send for Args<'a, A>

§

impl<'a, A> !Sync for Args<'a, A>

§

impl<'a, A> Unpin for Args<'a, A>

§

impl<'a, A> !UnwindSafe for Args<'a, A>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

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>

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)

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)

Convert &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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more