Skip to main content

Scope

Struct Scope 

Source
pub struct Scope { /* private fields */ }
Expand description

A prepared component. Publish only after all fallible preparation succeeds.

Implementations§

Source§

impl Scope

Source

pub fn text<T: Display>( &mut self, id: usize, read: impl Fn() -> T + 'static, ) -> Result<(), Error>

Source

pub fn on<R: EventResult>( &mut self, id: usize, name: &'static str, callback: impl FnMut(Event) -> R + 'static, ) -> Result<(), Error>

Source

pub fn bind_text( &mut self, id: usize, model: impl TextValue, ) -> Result<(), Error>

Source

pub fn bind_checkbox( &mut self, id: usize, model: impl Checkbox, choice: impl Fn() -> String + 'static, ) -> Result<(), Error>

Source

pub fn value<T: Display>( &mut self, id: usize, read: impl Fn() -> T + 'static, ) -> Result<(), Error>

Source

pub fn checked( &mut self, id: usize, read: impl Fn() -> bool + 'static, ) -> Result<(), Error>

Source

pub fn attribute<T: Display>( &mut self, id: usize, name: &'static str, read: impl Fn() -> T + 'static, ) -> Result<(), Error>

Source

pub fn boolean( &mut self, id: usize, name: &'static str, read: impl Fn() -> bool + 'static, ) -> Result<(), Error>

Source

pub fn class( &mut self, id: usize, name: &'static str, read: impl Fn() -> bool + 'static, ) -> Result<(), Error>

Source§

impl Scope

Source

pub fn is_coherent(&self) -> bool

Source

pub fn set_coherent_renderer( &mut self, render: impl Fn(&mut Frame<'_>) -> Result<(), String> + 'static, )

Source

pub fn async_region( &mut self, id: usize, boundary: AsyncBoundary, render: impl Fn(&mut Frame<'_>) -> Result<(), String> + 'static, ) -> Result<(), Error>

Source§

impl Scope

Source

pub fn new( parent: Option<&OwnerHandle>, specs: &[StaticNode], ) -> Result<Self, Error>

Source

pub fn with_styles( parent: Option<&OwnerHandle>, specs: &[StaticNode], styles: StyleSheet, ) -> Result<Self, Error>

Source

pub fn owner(&self) -> OwnerHandle

Source

pub fn root(&self) -> Node

Source

pub fn publish(&self)

Source

pub fn dispose(&self)

Source

pub fn take_errors(&self) -> Vec<Error>

Source

pub fn take_dirty(&self) -> bool

Source

pub fn is_faulted(&self) -> bool

A publication fault makes further interaction unsafe; the host must exit.

Source

pub fn retain<T: 'static>(&mut self, value: T) -> Rc<T>

Source§

impl Scope

Source

pub fn branch<T: Clone + PartialEq + 'static>( &mut self, id: usize, read: impl Fn() -> (usize, T) + 'static, prepare: impl Fn(usize, Signal<T>, &OwnerHandle) -> Result<Scope, Error> + 'static, ) -> Result<(), Error>

Source

pub fn keyed<T: Clone + PartialEq + 'static, K: Ord + Clone + 'static>( &mut self, id: usize, read: impl Fn() -> Vec<T> + 'static, key: impl Fn(&T) -> K + 'static, prepare: impl Fn(Signal<T>, &OwnerHandle) -> Result<Scope, Error> + 'static, ) -> Result<(), Error>

Source

pub fn component<T: Component, K: Clone + PartialEq + 'static, I: Fn() -> Option<K> + 'static, M: Fn(OwnerHandle) -> Result<T, Error> + 'static>( &mut self, id: usize, identity: I, make: M, children: Children, ) -> Result<(), Error>

Source

pub fn children(&mut self, id: usize, children: &Children) -> Result<(), Error>

Trait Implementations§

Source§

impl Drop for Scope

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

impl RouteScope for Scope

Source§

type Target = Node

Source§

type Error = Error

Source§

fn error(message: &str) -> Error

Source§

fn prepare_at( &mut self, target: &Node, _parent_active: bool, ) -> Result<(), Error>

Validate that the view is detached, attach it without activation, and finish fallible renderer setup. When parent_active is true, finish the complete candidate subtree before returning. A failure or later drop must undo attachment without disturbing the current view. Read more
Source§

fn commit(&self)

Activate the prepared scope after its route owner has activated.
Source§

impl Scope for Scope

Source§

fn owner(&self) -> OwnerHandle

Source§

fn retain_state<T: 'static>(&mut self, value: T) -> Rc<T>

Source§

fn prepares_effects(&self) -> bool

Explicit candidate preparation defers constructor effects until activation. Ordinary mounting preserves their immediate execution.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Scope

§

impl !Send for Scope

§

impl !Sync for Scope

§

impl !UnwindSafe for Scope

§

impl Freeze for Scope

§

impl Unpin for Scope

§

impl UnsafeUnpin for Scope

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.