pub struct App<State> { /* private fields */ }
Implementations§
Source§impl<State> App<State>where
State: 'static + Default,
impl<State> App<State>where
State: 'static + Default,
Sourcepub fn new(handle: Handle) -> App<State>
pub fn new(handle: Handle) -> App<State>
Examples found in repository?
examples/todo.rs (line 352)
347pub fn main() -> Result<(), ()> {
348
349 let mut core = Core::new().unwrap();
350 let handle = core.handle();
351
352 let mut app = App::new(handle);
353 setup(&mut app);
354
355 let handle = core.handle();
356 handle.spawn(app.dispatch(ShowMenu).map(|_| ()).map_err(|_| ()));
357
358 let std_in_ch = spawn_stdin_stream_unbounded();
359 core.run(std_in_ch.for_each(|m| {
360 app.dispatch(Input(m)).map(|_| ()).map_err(|_| ())
361 }))?;
362
363 Ok(())
364}
pub fn default_interceptors(&self) -> Vec<Box<dyn Interceptor<Error = ()>>>
Sourcepub fn register_event<E: 'static + Event<()>>(&mut self)
pub fn register_event<E: 'static + Event<()>>(&mut self)
Sourcepub fn register_event_with<E: 'static + Event<()>>(
&mut self,
interceptors: Vec<Box<dyn Interceptor<Error = ()>>>,
)
pub fn register_event_with<E: 'static + Event<()>>( &mut self, interceptors: Vec<Box<dyn Interceptor<Error = ()>>>, )
Sourcepub fn dispatch<E: 'static + Event<()>>(&mut self, e: E) -> impl Future
pub fn dispatch<E: 'static + Event<()>>(&mut self, e: E) -> impl Future
Examples found in repository?
examples/todo.rs (line 356)
347pub fn main() -> Result<(), ()> {
348
349 let mut core = Core::new().unwrap();
350 let handle = core.handle();
351
352 let mut app = App::new(handle);
353 setup(&mut app);
354
355 let handle = core.handle();
356 handle.spawn(app.dispatch(ShowMenu).map(|_| ()).map_err(|_| ()));
357
358 let std_in_ch = spawn_stdin_stream_unbounded();
359 core.run(std_in_ch.for_each(|m| {
360 app.dispatch(Input(m)).map(|_| ()).map_err(|_| ())
361 }))?;
362
363 Ok(())
364}
Auto Trait Implementations§
impl<State> Freeze for App<State>
impl<State> !RefUnwindSafe for App<State>
impl<State> !Send for App<State>
impl<State> !Sync for App<State>
impl<State> Unpin for App<State>
impl<State> !UnwindSafe for App<State>
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