Struct oxygengine_user_interface::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 DataBinding
s.
See Application::process
for more information.
Implementations
Create an empty ProcessContext
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...
}
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.
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...
}
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.
Can be used to get immutable access to owned objects available for current application processing run provided by the RAUI host.
Example
fn my_component(ctx: WidgetContext) -> WidgetNode {
let app_data = ctx.process_context.owned_ref::<AppData>().unwrap();
let counter = app_data.counter;
// widget stuff...
}
Can be used to get mutable access to owned objects available for current application processing run provided by the RAUI host.
Example
fn my_component(ctx: WidgetContext) -> WidgetNode {
let app_data = ctx.process_context.owned_mut::<AppData>().unwrap();
let counter = app_data.counter;
// widget stuff...
}
Allows RAUI hosts to add owned objects to application data to the
process_context
that is
available to widget components.
Trait Implementations
Returns the “default value” for a type. Read more