Struct rui::Context

source ·
pub struct Context {
    pub key_mods: KeyboardModifiers,
    pub window_title: String,
    pub fullscreen: bool,
    /* private fields */
}
Expand description

The Context stores all UI state. A user of the library shouldn’t have to interact with it directly.

Fields§

§key_mods: KeyboardModifiers

Keyboard modifiers state.

§window_title: String

The current title of the window

§fullscreen: bool

Are we fullscreen?

Implementations§

source§

impl Context

source

pub fn new() -> Self

source

pub fn update( &mut self, view: &impl View, vger: &mut Vger, access_nodes: &mut Vec<(NodeId, Node)>, window_size: Size2D<f32, WorldSpace> ) -> bool

Call this after the event queue is cleared.

source

pub fn render( &mut self, render_info: RenderInfo<'_>, view: &impl View, vger: &mut Vger, window_size: Size2D<f32, WorldSpace>, scale: f32 )

Redraw the UI using wgpu.

source

pub fn process(&mut self, view: &impl View, event: &Event)

Process a UI event.

source

pub fn commands(&mut self, view: &impl View, cmds: &mut Vec<CommandInfo>)

Get menu commands.

source

pub fn get<S>(&self, id: StateHandle<S>) -> &Swhere S: 'static,

source

pub fn get_mut<S>(&mut self, id: StateHandle<S>) -> &mut Swhere S: 'static,

Trait Implementations§

source§

impl Default for Context

source§

fn default() -> Self

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

impl<S> Index<StateHandle<S>> for Contextwhere S: 'static,

§

type Output = S

The returned type after indexing.
source§

fn index(&self, index: StateHandle<S>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<S> IndexMut<StateHandle<S>> for Contextwhere S: 'static,

source§

fn index_mut(&mut self, index: StateHandle<S>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Context

§

impl !Send for Context

§

impl !Sync for Context

§

impl Unpin for Context

§

impl !UnwindSafe for Context

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>