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]
impl<'a> ProcessContext<'a>[src]pub fn new() -> Self[src]
pub fn new() -> Self[src]Create an empty ProcessContext
pub fn get_mut<T: 'static>(&mut self) -> Option<&mut T>[src]
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]
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]
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]
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]
impl<'a> Debug for ProcessContext<'a>[src]impl<'a> Default for ProcessContext<'a>[src]
impl<'a> Default for ProcessContext<'a>[src]fn default() -> ProcessContext<'a>[src]
fn default() -> ProcessContext<'a>[src]Returns the “default value” for a type. Read more