pub struct Builder { /* private fields */ }
Expand description
A terminal configuration builder.
Implementations§
source§impl Builder
impl Builder
sourcepub fn min_screen(self, min_screen: Vec2) -> Self
pub fn min_screen(self, min_screen: Vec2) -> Self
Builds the minimum screen size for the application.
sourcepub fn frame_time(self, frame_time: Duration) -> Self
pub fn frame_time(self, frame_time: Duration) -> Self
Builds the rate that the screen is updated.
sourcepub fn event_interval(self, event_interval: Duration) -> Self
pub fn event_interval(self, event_interval: Duration) -> Self
Interval waited when a poll for an event fails.
sourcepub async fn run<F, A, T>(self, start: F) -> Result<T, Error>where
F: FnOnce(Terminal) -> A + Send + 'static,
A: Future<Output = T> + Send + 'static,
T: Send + 'static,
pub async fn run<F, A, T>(self, start: F) -> Result<T, Error>where F: FnOnce(Terminal) -> A + Send + 'static, A: Future<Output = T> + Send + 'static, T: Send + 'static,
Starts the application and gives it a handle to the terminal. When the given start function finishes, the application’s execution stops as well.
After that start
’s future returns, terminal services such as screen
handle and events handle are not guaranteed to be available. One would
prefer spawning tasks that use the terminal handle by joining them, and
not detaching.
Returns an AlreadyRunning
error if there is already an instance of
terminal services executing. In other words, one should not call
this function again if another call did not finish yet, otherwise it
will panic.
Beware! If the given start
future returns a Result
, then run
will
return a double Result
!!
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
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
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
source§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
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, Global>) -> Rc<dyn Any, Global>
fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
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)
&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)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.