pub struct App {
pub theme: Mutable<Arc<Theme>>,
pub animator: Mutex<Animator>,
/* private fields */
}Expand description
The boba application runner.
Create an App with your View implementation, configure its theme,
then run it asynchronously. The terminal is managed automatically:
raw mode is enabled, an alternate screen is used, and state is restored on exit.
Fields§
§theme: Mutable<Arc<Theme>>The currently active Theme. Change it with App::set_theme.
animator: Mutex<Animator>Implementations§
Source§impl App
impl App
Sourcepub fn new(v: impl View + 'static) -> Self
pub fn new(v: impl View + 'static) -> Self
Construct an app wrapping view.
Examples found in repository?
More examples
Sourcepub async fn run(self) -> Result<()>
pub async fn run(self) -> Result<()>
Run the app until a AppEvent::Quit is emitted.
Initializes raw mode, the alternate screen, and mouse capture; restores everything on exit.
Examples found in repository?
More examples
Methods from Deref<Target = EventTarget<AppEvent>>§
Sourcepub fn set_parent(&self, _name: impl Into<String>, parent: Weak<EventTarget<T>>)
pub fn set_parent(&self, _name: impl Into<String>, parent: Weak<EventTarget<T>>)
Attach a parent target so events can bubble up.
Sourcepub fn emit_bubbling(&self, v: impl Into<Arc<T>> + Debug)
pub fn emit_bubbling(&self, v: impl Into<Arc<T>> + Debug)
Emit and bubble up the parent chain.
pub fn on( &self, priority: SubscriptionPriority, handler: impl Fn(Arc<Cancellable<T>>) + Send + Sync + 'static, ) -> SubscriptionHandle<T>
pub fn as_stream(&self, p: SubscriptionPriority) -> EventStream<T>
Sourcepub fn on_key(
&self,
priority: SubscriptionPriority,
handler: impl Fn(Arc<Cancellable<AppEvent>>, KeyEvent) + Send + Sync + 'static,
) -> SubscriptionHandle<AppEvent>
pub fn on_key( &self, priority: SubscriptionPriority, handler: impl Fn(Arc<Cancellable<AppEvent>>, KeyEvent) + Send + Sync + 'static, ) -> SubscriptionHandle<AppEvent>
Subscribe only to AppEvent::KeyEvent payloads.
The handler receives the original event (so it can call Cancellable::cancel)
plus the extracted KeyEvent.
Examples found in repository?
More examples
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for App
impl !RefUnwindSafe for App
impl !Send for App
impl !Sync for App
impl !UnwindSafe for App
impl Unpin for App
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more