pub struct Application {
    pub view: RcNode,
    pub fonts: HashMap<Option<String>, Arc<Mutex<Font>>>,
    pub default_font_size: usize,
    pub data_requests: Vec<DataRequest>,
    pub model: Box<dyn Any>,
    pub output: Bitmap,
    pub should_recompute: bool,
}
Expand description

The Application structure represents your application. It has a [Tree] containing nodes, a model field where you can store your application-specific model, and a vector of DataRequest where you can add you own data requests (which the platform will handle).

Fields

view: RcNodefonts: HashMap<Option<String>, Arc<Mutex<Font>>>

Fonts that can be used by widgets to draw glyphs

default_font_size: usize

Default font size used by textual widgets

data_requests: Vec<DataRequest>

Data requests allow widgets to load external assets, partially or completely. You can append new ones to this vector.

model: Box<dyn Any>

This field’s content is completely up to you. You should use it to store the global state of your application.

output: Bitmap

This Bitmap is used to store the final frame of the application, to be rendered by the platform.

should_recompute: bool

Implementations

The Application constructor. If you omit the tree argument, it will be initialized to an empty tree.

This getter allows you to get your model as its initial type. If M is the original type of your model, this will return Some, and None if it is not.

Under the hood, this is a simple downcast.

Adds a font to the font store. If default is true, this font will be used by default when textual nodes are created.

This method is called by the platform to request a refresh of the output. It should be called for every frame.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.