Application

Struct Application 

Source
pub struct Application {
    pub view_models: ViewModelCollection,
    pub animations_delta_time: Scalar,
    /* private fields */
}
Expand description

Contains and orchestrates application layout, animations, interactions, etc.

See the application module for more information and examples.

Fields§

§view_models: ViewModelCollection§animations_delta_time: Scalar

The amount of time between the last update, used when calculating animation progress

Implementations§

Source§

impl Application

Source

pub fn setup<F>(&mut self, f: F)
where F: FnMut(&mut Self),

Setup the application with a given a setup function

We need to run the setup function for the application to register components and properties if we want to support serialization of the UI. We pass it a function that will do the actual registration.

Note: RAUI will work fine without running any setup if UI serialization is not required.

Source

pub fn notifier(&self) -> ChangeNotifier

Source

pub fn register_component(&mut self, type_name: &str, processor: FnWidget)

Register’s a component under a string name used when serializing the UI

This function is often used in setup functions for registering batches of components.

Source

pub fn unregister_component(&mut self, type_name: &str)

Unregisters a component

See register_component

Source

pub fn register_props<T>(&mut self, name: &str)
where T: 'static + Prefab + PropsData,

Register’s a property type under a string name used when serializing the UI

This function is often used in setup functions for registering batches of properties.

Source

pub fn unregister_props(&mut self, name: &str)

Unregisters a property type

See register_props

Source

pub fn serialize_props(&self, props: &Props) -> Result<PrefabValue, PrefabError>

Serialize the given Props to a PrefabValue

Source

pub fn deserialize_props(&self, data: PrefabValue) -> Result<Props, PrefabError>

Deserialize Props from a PrefabValue

Source

pub fn serialize_node( &self, data: &WidgetNode, ) -> Result<PrefabValue, ApplicationError>

Serialize a WidgetNode to a PrefabValue

Source

pub fn deserialize_node( &self, data: PrefabValue, ) -> Result<WidgetNode, ApplicationError>

Deserialize a WidgetNode from a PrefabValue

Source

pub fn last_invalidation_cause(&self) -> &InvalidationCause

Get the reason that the application state was last invalidated and caused to re-process

Source

pub fn dirty(&self) -> &WidgetIdCommon

Return’s common root widget ID of widgets that has to be to be re-processed

Source

pub fn mark_dirty(&mut self)

Force mark the application as needing to re-process its root

Source

pub fn does_render_changed(&self) -> bool

Source

pub fn tree(&self) -> &WidgetNode

Get the WidgetNode for the application tree

Source

pub fn rendered_tree(&self) -> &WidgetUnit

Get the application widget tree rendered to raw WidgetUnit’s

Source

pub fn layout_data(&self) -> &Layout

Get the application Layout data

Source

pub fn has_layout_widget(&self, id: &WidgetId) -> bool

Source

pub fn apply(&mut self, tree: impl Into<WidgetNode>)

Update the application widget tree

Source

pub fn render<R, T, E>( &self, mapping: &CoordsMapping, renderer: &mut R, ) -> Result<T, E>
where R: Renderer<T, E>,

Render the application

Source

pub fn render_change<R, T, E>( &mut self, mapping: &CoordsMapping, renderer: &mut R, ) -> Result<Option<T>, E>
where R: Renderer<T, E>,

Render the application, but only if something effecting the rendering has changed and it needs to be re-rendered

Source

pub fn layout<L, E>( &mut self, mapping: &CoordsMapping, layout_engine: &mut L, ) -> Result<(), E>
where L: LayoutEngine<E>,

Calculate application layout

Source

pub fn layout_change<L, E>( &mut self, mapping: &CoordsMapping, layout_engine: &mut L, ) -> Result<bool, E>
where L: LayoutEngine<E>,

Calculate application layout, but only if something effecting application layout has changed and the layout needs to be re-done

Source

pub fn interact<I, R, E>(&mut self, interactions_engine: &mut I) -> Result<R, E>
where I: InteractionsEngine<R, E>,

Perform interactions on the application using the given interaction engine

Source

pub fn send_message<T>(&mut self, id: &WidgetId, data: T)
where T: 'static + MessageData,

Send a message to the given widget

Source

pub fn send_message_raw(&mut self, id: &WidgetId, data: Message)

Send raw message data to the given widget

Source

pub fn signals(&self) -> &[Signal]

Get the list of signals that have been sent by widgets

Source

pub fn consume_signals(&mut self) -> Vec<Signal>

Get the list of signals that have been sent by widgets, consuming the current list so that further calls will not include previously sent signals

Source

pub fn forced_process(&mut self) -> bool

process() application, even if no changes have been detected

Source

pub fn process(&mut self) -> bool

Process the application.

Trait Implementations§

Source§

impl Default for Application

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> Finalize for T

Source§

unsafe fn finalize_raw(data: *mut ())

Safety Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Initialize for T
where T: Default,

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.