Struct raui_core::application::ProcessContext[][src]

pub struct ProcessContext<'a> { /* fields omitted */ }
Expand description

Allows you to get mutable or immutable references to data exposed by the host of the RAUI application

This allows RAUI hosts to provide the UI with direct access to application data, if necessary, instead of using DataBindings.

See Application::process for more information.

Implementations

impl<'a> ProcessContext<'a>[src]

pub fn new() -> Self[src]

Create an empty ProcessContext

pub fn get_mut<T: 'static>(&mut self) -> Option<&mut T>[src]

Can be used to get mutable access to application data provided by the RAUI host.

Example

fn my_component(ctx: WidgetContext) -> WidgetNode {
    let app_data = ctx.process_context.get_mut::<AppData>().unwrap();
    let counter = &mut app_data.counter;
    *counter += 1;

    // widget stuff...
}

pub fn insert_mut<T: 'static>(&mut self, item: &'a mut T) -> &mut Self[src]

Allows RAUI hosts to add mutable references to application data to the process_context that is available to widget components.

See Application::process for more information.

pub fn get<T: 'static>(&mut self) -> Option<&T>[src]

Can be used to get immutable access to application data provided by the RAUI host.

Example

fn my_component(ctx: WidgetContext) -> WidgetNode {
    let app_data = ctx.process_context.get::<AppData>().unwrap();
    let counter = app_data.counter;

    // widget stuff...
}

pub fn insert<T: 'static>(&mut self, item: &'a T) -> &mut Self[src]

Allows RAUI hosts to add immutable references to application data to the process_context that is available to widget components.

See Application::process for more information.

Trait Implementations

impl<'a> Debug for ProcessContext<'a>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<'a> Default for ProcessContext<'a>[src]

fn default() -> ProcessContext<'a>[src]

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

Auto Trait Implementations

impl<'a> !RefUnwindSafe for ProcessContext<'a>

impl<'a> !Send for ProcessContext<'a>

impl<'a> !Sync for ProcessContext<'a>

impl<'a> Unpin for ProcessContext<'a>

impl<'a> !UnwindSafe for ProcessContext<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.