Skip to main content

Program

Struct Program 

Source
pub struct Program<M: Model> { /* private fields */ }
Expand description

Program is the runner for a Bubble Tea v2.0.8 application.

Implementations§

Source§

impl<M: Model> Program<M>

Source

pub fn new(model: M) -> Self

Creates a new Program for the given model with default options.

Source

pub fn with_options(self, options: ProgramOptions<M>) -> Self

Sets custom program options.

Source

pub fn send(&self, msg: Box<dyn Msg>)

Send sends a message to the main update function, effectively allowing messages to be injected from outside the program for interoperability purposes.

Source

pub fn quit(&self)

Quit is a convenience function for quitting Bubble Tea programs. Use it when you need to shut down a Bubble Tea program from the outside.

Source

pub fn kill(&mut self)

Kill stops the program immediately and restores the former terminal state. The final render that you would normally see when quitting will be skipped. [Program.Run] returns a [ErrProgramKilled] error.

Source

pub fn wait(&self)

Wait waits/blocks until the underlying Program finished shutting down.

Source

pub fn println(&self, args: &str)

Println prints above the Program. This output is unmanaged by the program and will persist across renders by the Program.

Source

pub fn printf(&self, body: &str)

Printf prints above the Program. It takes a format template followed by values similar to fmt.Printf.

Source

pub fn run(self) -> Result<M, Box<dyn Error>>

Runs the Bubble Tea v2.0.8 event loop until quit.

Auto Trait Implementations§

§

impl<M> !RefUnwindSafe for Program<M>

§

impl<M> !UnwindSafe for Program<M>

§

impl<M> Freeze for Program<M>
where M: Freeze,

§

impl<M> Send for Program<M>

§

impl<M> Sync for Program<M>

§

impl<M> Unpin for Program<M>
where M: Unpin,

§

impl<M> UnsafeUnpin for Program<M>
where M: UnsafeUnpin,

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.