Skip to main content

RenderCx

Struct RenderCx 

Source
pub struct RenderCx<'a, 'ctx> { /* private fields */ }

Implementations§

Source§

impl<'a, 'ctx> RenderCx<'a, 'ctx>

Source

pub fn new(scope: &UiScope, context: &'ctx UiRenderContext<'a>) -> Self

Source

pub fn node_id(&self) -> UiId

Source

pub fn viewport(&self) -> UiRect

Source

pub fn application(&mut self) -> ApplicationContext

Source

pub fn command<C>(&mut self) -> CommandHandle<C>
where C: Command,

Source

pub fn use_event<E>( &mut self, deps: impl Clone + PartialEq + 'static, handler: impl Fn(E) + Send + Sync + 'static, )
where E: Event,

Source

pub fn use_event_once<E>(&mut self, handler: impl Fn(E) + Send + Sync + 'static)
where E: Event,

Source

pub fn use_event_async<E>( &mut self, deps: impl Clone + PartialEq + 'static, handler: impl AsyncEventHandler<E>, )
where E: Event,

Source

pub fn use_event_async_once<E>(&mut self, handler: impl AsyncEventHandler<E>)
where E: Event,

Source

pub fn listen<T>( &mut self, key: EventKey<T>, listener: impl Fn(T) + Send + Sync + 'static, )
where T: Clone + Send + Sync + 'static,

Listens for a typed Event key for this component’s mounted lifetime.

The listener is installed only after a successful present and is automatically removed when this component unmounts or the key changes.

Source

pub fn listen_with<T, D>( &mut self, key: EventKey<T>, deps: D, listener: impl Fn(T) + Send + Sync + 'static, )
where T: Clone + Send + Sync + 'static, D: Clone + PartialEq + 'static,

Listens for a typed Event key and replaces the listener when deps changes.

Source

pub fn listen_async<T, F, Fut>(&mut self, key: EventKey<T>, listener: F)
where T: Clone + Send + Sync + 'static, F: Fn(T) -> Fut + Send + Sync + 'static, Fut: Future<Output = ()> + Send + 'static,

Listens for a typed Event key and schedules each callback Future on the Application executor.

Source

pub fn listen_async_with<T, D, F, Fut>( &mut self, key: EventKey<T>, deps: D, listener: F, )
where T: Clone + Send + Sync + 'static, D: Clone + PartialEq + 'static, F: Fn(T) -> Fut + Send + Sync + 'static, Fut: Future<Output = ()> + Send + 'static,

Asynchronously listens for a typed Event key and replaces the listener when deps changes.

Source

pub fn use_state<T>( &mut self, initial: impl FnOnce() -> T, ) -> (T, StateSetter<T>)
where T: Clone + Send + 'static,

Source

pub fn use_state_eq<T>( &mut self, initial: impl FnOnce() -> T, ) -> (T, StateSetter<T>)
where T: Clone + PartialEq + Send + 'static,

Source

pub fn state<T>(&mut self, initial: T) -> State<T>
where T: Clone + Send + 'static,

Source

pub fn state_with<T>(&mut self, initial: impl FnOnce() -> T) -> State<T>
where T: Clone + Send + 'static,

Source

pub fn use_component_state<T, R>( &mut self, update: impl FnOnce(&mut T) -> R, ) -> R
where T: ComponentState + Clone + Default + 'static,

Source

pub fn use_effect<D, F, R>(&mut self, deps: D, effect: F)
where D: Clone + PartialEq + 'static, F: FnOnce() -> R + 'static, R: IntoEffectCleanup,

Source

pub fn use_effect_once<F>(&mut self, effect: F)
where F: FnOnce() + 'static,

Source

pub fn use_mount<F>(&mut self, effect: F)
where F: FnOnce() + 'static,

Source

pub fn use_context<T>(&mut self) -> T
where T: Clone + 'static,

Source

pub fn try_use_context<T>(&mut self) -> Option<T>
where T: Clone + 'static,

Source

pub fn use_observable<T, S, F>( &mut self, source: Observable<T>, selector: F, ) -> S
where T: Send + 'static, S: Clone + PartialEq + Send + 'static, F: Fn(&T) -> S + Copy + Send + Sync + 'static,

Trait Implementations§

Source§

impl Drop for RenderCx<'_, '_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'a, 'ctx> !RefUnwindSafe for RenderCx<'a, 'ctx>

§

impl<'a, 'ctx> !Send for RenderCx<'a, 'ctx>

§

impl<'a, 'ctx> !Sync for RenderCx<'a, 'ctx>

§

impl<'a, 'ctx> !UnwindSafe for RenderCx<'a, 'ctx>

§

impl<'a, 'ctx> Freeze for RenderCx<'a, 'ctx>

§

impl<'a, 'ctx> Unpin for RenderCx<'a, 'ctx>

§

impl<'a, 'ctx> UnsafeUnpin for RenderCx<'a, 'ctx>

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.