Skip to main content

Scope

Struct Scope 

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

Implementations§

Source§

impl Scope

Source

pub fn id(&self) -> InstanceId

Source

pub fn owner(&self) -> &Owner

Source

pub fn has_task_host(&self) -> Result<bool, AccessError>

Whether this live Scope has an explicitly installed task execution service. This neither constructs/polls a future nor asks the host to perform work. An installed but closed/limited host still reports its normal spawn error.

Source

pub fn child(&self) -> Self

Source

pub fn parent(&self) -> Option<InstanceId>

Source

pub fn is_alive(&self) -> bool

Methods from Deref<Target = Owner>§

Source

pub fn resource<K, T, E, F>( &self, source: impl Fn() -> K + 'static, load: impl Fn(K) -> F + 'static, ) -> Resource<K, T, E>
where K: Clone + PartialEq + 'static, T: 'static, E: 'static, F: Future<Output = Result<T, E>> + 'static,

Start/restart after tracked source-key changes at the effect phase. A missing Host produces Unavailable rather than a blocking fallback.

Source

pub fn resource_seeded<K, T, E, F>( &self, source: impl Fn() -> K + 'static, load: impl Fn(K) -> F + 'static, seed: Option<ResourceSeed<K, T, E>>, ) -> Resource<K, T, E>
where K: Clone + PartialEq + 'static, T: 'static, E: 'static, F: Future<Output = Result<T, E>> + 'static,

Source

pub fn keyed_list<K: Clone + Eq + Hash + 'static, T: 'static>( &self, initial: Vec<T>, key: impl Fn(&T) -> K + 'static, ) -> Result<KeyedList<K, T>, ListError>

Source

pub fn selector<K: Clone + Eq + Hash + 'static>( &self, source: Cage<Option<K>>, ) -> Result<Selector<K>, AccessError>

Source

pub fn enter<R>(&self, f: impl FnOnce() -> R) -> R

Derived maps created by this widget/factory belong to this owner, even when their source is application-wide. The context never owns data.

Source

pub fn runtime(&self) -> RuntimeId

Source

pub fn is_alive(&self) -> bool

Source

pub fn check_write(&self) -> Result<(), AccessError>

Check liveness and mutation permission before an adapter changes host state. This publishes nothing and does not reserve a later source write.

Source

pub fn child(&self) -> Self

Source

pub fn dispose(&self)

Source

pub fn on_cleanup( &self, cleanup: impl FnOnce() + 'static, ) -> Result<(), AccessError>

Run untracked after this Owner and its descendants have been invalidated. Implicit map/path construction remains in the retired Owner and fails; explicit entry into another live Owner is allowed. Callbacks run without graph borrows, in reverse registration order (children before parents). A panic unwinds normally; there is no catch/retry of remaining callbacks.

Source

pub fn cage<T: 'static>(&self, value: T) -> Cage<T>

Source

pub fn compute<T>(&self, f: impl FnOnce() -> T) -> Result<T, AccessError>

Synchronous, untracked pure computation under this live Owner. Allocates no reactive node. Both reads and unwind restore the outer tracking/mode/construction context; writes/creation remain forbidden.

Source

pub fn bond<T: 'static>(&self, mapper: impl Fn() -> T + 'static) -> Bond<T>

Source

pub fn binding(&self, callback: impl FnMut() + 'static) -> BindingId

Source

pub fn effect(&self, callback: impl FnMut() + 'static) -> BindingId

Effects run after currently queued bindings. Writes enqueue another pass; reads still form direct dependencies, and runaway loops fail explicitly.

Source

pub fn structural(&self, callback: impl FnMut() + 'static) -> BindingId

Structural controllers update owned row state before prop bindings run. Use this for tree control flow; ordinary computed props remain pure.

Source

pub fn task(&self) -> Task

Source

pub fn spawn( &self, future: impl Future<Output = ()> + 'static, ) -> Result<TaskToken, AccessError>

Trait Implementations§

Source§

impl Debug for Scope

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for Scope

Source§

type Target = Owner

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Owner

Dereferences the value.

Auto Trait Implementations§

§

impl !Send for Scope

§

impl !Sync for Scope

§

impl Forget for Scope

§

impl Freeze for Scope

§

impl RefUnwindSafe for Scope

§

impl Unpin for Scope

§

impl UnsafeUnpin for Scope

§

impl UnwindSafe 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.