EventLoop

Struct EventLoop 

Source
pub struct EventLoop<E: 'static> { /* private fields */ }
Available on crate feature EventLoop only.
Expand description

Application event loop.

use concoct::{Context, Object};
use viewbuilder::{event_loop::Event, EventLoop};
 
struct App;
 
impl Object for App {}
 
impl App {
    pub fn event(_cx: &mut Context<Self>, event: Event<()>) {
        dbg!(event);
    }
}
 
let event_loop = EventLoop::<()>::create();
 
let app = App.start();
event_loop.bind(&app, App::event);

EventLoop::run(event_loop);

Implementations§

Source§

impl<E: 'static> EventLoop<E>

Source

pub fn new() -> Self

Source

pub fn wait(&mut self)

Source

pub fn wait_until(&mut self, instant: Instant)

Source

pub fn exit(&mut self, code: i32)

Source

pub fn run(handle: Handle<Self>)

Examples found in repository?
examples/window.rs (line 23)
14fn main() {
15    let event_loop = EventLoop::<()>::create();
16
17    let window = Window::create();
18    Window::insert(&mut window.cx(), &event_loop);
19
20    let app = App.start();
21    window.bind(&app, App::event);
22
23    EventLoop::run(event_loop);
24}

Trait Implementations§

Source§

impl<E: 'static> Default for EventLoop<E>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<E> Object for EventLoop<E>

Source§

fn started(cx: &mut Context<'_, Self>)
where Self: Sized + 'static,

Called when the object is first started.
Source§

fn start(self) -> Handle<Self>
where Self: Sized + 'static,

Start this object and create a handle.
Source§

fn create() -> Handle<Self>
where Self: Default + 'static,

Create a handle to a new default object.
Source§

impl<E: 'static> Signal<Event<E>> for EventLoop<E>

Source§

fn emit(cx: &mut Context<'_, Self>, msg: M)

Emit a message from this object. Read more

Auto Trait Implementations§

§

impl<E> !Freeze for EventLoop<E>

§

impl<E> !RefUnwindSafe for EventLoop<E>

§

impl<E> !Send for EventLoop<E>

§

impl<E> !Sync for EventLoop<E>

§

impl<E> Unpin for EventLoop<E>
where E: Unpin,

§

impl<E> !UnwindSafe for EventLoop<E>

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.