Skip to main content

Scope

Struct Scope 

Source
pub struct Scope(/* private fields */);
Expand description

A UI context carries semantic parent identity, never a DOM/GPU object. Core ownership remains separate; all presentation helpers work on any Render.

Implementations§

Source§

impl Scope

Source

pub fn instantiate(&self, plan: &Plan) -> Result<PlanInstance>

Source

pub fn mount_with<W: Widget>( &self, factory: impl FnOnce() -> W, ) -> Result<Mounted>

Source

pub fn downgrade(&self) -> WeakScope

A callback may upgrade transiently without retaining its owning UI scope.

Source

pub fn batch<R>(&self, callback: impl FnOnce() -> R) -> Result<R>

Apply several writes as one observation boundary. Nested calls remain atomic and unwind releases the boundary. Host output still commits at the App’s normal flush/event boundary.

Source

pub fn child(&self) -> Result<Self>

Source

pub fn child_in(&self, parent: NodeId) -> Result<Self>

Source

pub fn is_within(&self, parent: NodeId) -> Result<bool>

Whether this Scope’s construction parent is the supplied live node or one of its staged descendants. Reads semantic ancestry only; hidden and suspended nodes remain valid, with no host query or commit barrier.

Source

pub fn contains_node(&self, ancestor: NodeId, node: NodeId) -> Result<bool>

Whether the current staged semantic subtree rooted at ancestor contains node, including the ancestor itself. Both identities and this requesting Scope must still be live. Hidden, suspended and boxless nodes keep their logical ancestry; use is_active separately before a physical observation. No flush, host lookup or construction-parent assumption is involved, so explicit Place is visible immediately.

Source

pub fn retain(&self, resource: impl Any) -> Result

Source

pub fn create(&self, descriptor: Descriptor) -> Result<NodeId>

Source

pub fn patch(&self, id: NodeId, patch: Patch) -> Result

Source

pub fn place( &self, node: NodeId, parent: Option<NodeId>, before: Option<NodeId>, ) -> Result

Move a live semantic range to an explicit parent, retaining its original Owner. Shared placement rules and adapter preflight run before changing the model or queue; suspended ranges resume through the same path.

Read the accepted semantic link target/context without host I/O or a commit barrier. A rejected source update never changes this snapshot.

Source

pub fn action(&self, action: Action) -> Result

Source

pub fn set_file_configuration( &self, node: NodeId, configuration: FileConfig, ) -> Result<u64>

Validate a complete finite configuration before allocating a revision. Equal declarations preserve the current selection and request lifetime.

Source

pub fn clear_files(&self, node: NodeId) -> Result

Source

pub fn remove_file(&self, file: FileToken) -> Result

Source

pub fn pick_files(&self, node: NodeId) -> Result<u64>

Source

pub fn copy_text(&self, node: NodeId) -> Result<u64>

Queue an explicit text write from this live Button’s accepted source. The returned identity is strictly increasing for its NodeId lifetime.

Source

pub fn set_input_selection( &self, node: NodeId, selection: TextSelection, ) -> Result

Queue an exact UTF-16 selection using this Input’s current program revision. Call after set_input_value when formatting changed the value. Surrogate interiors are invalid; a host may refuse subcluster positions.

Source

pub fn set_rich_document( &self, node: NodeId, document: Rc<RichDocument>, ) -> Result<u64>

Explicit program document write, even when equal, acknowledges or rejects a physical draft using a new revision from the live node.

Source

pub fn rich_editor_value(&self, node: NodeId) -> Result<(Rc<RichDocument>, u64)>

Read staged accepted state, without a host query or flush.

Source

pub fn rich_editor_editable(&self, node: NodeId) -> Result<bool>

Source

pub fn set_rich_selection( &self, node: NodeId, selection: RichSelection, ) -> Result

Source

pub fn request( &self, query: Query, reply: impl FnOnce(Result<QueryValue, RenderError>) + 'static, ) -> Result<QueryToken>

Flush before observing a host value. The reply executes under this Scope’s Owner, independent of the target’s Owner or the pump caller. Scope disposal drops its waiters without calling user code; a removed target completes a still-live request with NodeGone. No Scope is retained.

Source

pub fn cancel_request(&self, token: QueryToken) -> Result<bool>

Revoke this Scope’s pending reply without attempting to undo host work. Tokens are local to their App. Missing/completed tokens return false; another live Scope’s token is rejected before either index is changed.

Source

pub fn capabilities(&self) -> Result<Capabilities>

Source

pub fn style_profile(&self) -> Result<Profile>

Source

pub fn is_active(&self, node: NodeId) -> Result<bool>

Source

pub fn is_enabled(&self, node: NodeId) -> Result<bool>

Current semantic enabled ancestry, without a host query or flush. This is independent of placement/visibility, which is_active checks.

Source

pub fn defer_descendant_disposal(&self, node: NodeId) -> Result

Keep this owned node out of an earlier child’s retired-ancestor coalescing. Its own Owner cleanup still disposes it normally. This lets that Owner move live foreign ranges before their semantic parent dies; it does not keep the Owner or its own descendants alive. The marker is reclaimed whenever the node is disposed, including ancestor disposal.

Source

pub fn is_inert(&self, node: NodeId) -> Result<bool>

Current inherited inert state. This reads the logical live tree only.

Source

pub fn on( &self, node: NodeId, kind: EventKind, handler: impl FnMut(Event) + 'static, ) -> Result

Source§

impl Scope

Source

pub fn set_input_value(&self, node: NodeId, value: impl Into<String>) -> Result

Write a text input using the next revision of the live semantic node. Equal values still acknowledge host edits without resetting caret/preedit. Call after a host tick (for example in an owned Effect), so later events from that tick retain their original revision until routing completes.

Source

pub fn set_select_selection( &self, node: NodeId, keys: Vec<SemanticId>, ) -> Result

Reconcile a native select after a complete host tick using its live revision.

Source

pub fn set_image_source( &self, node: NodeId, source: impl Into<String>, ) -> Result

Start a new image request revision, including an explicit same-URL retry.

Source

pub fn report_error(&self, error: impl Into<Error>)

Report a custom widget’s asynchronous Binding/Effect/handler error at the next App flush. Retired scopes ignore late errors without retaining App.

Methods from Deref<Target = 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) -> Scope

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, T>( &self, initial: Vec<T>, key: impl Fn(&T) -> K + 'static, ) -> Result<KeyedList<K, T>, ListError>
where K: Clone + Eq + Hash + 'static, T: 'static,

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 child(&self) -> Owner

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>(&self, value: T) -> Cage<T>
where T: 'static,

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>(&self, mapper: impl Fn() -> T + 'static) -> Bond<T>
where T: 'static,

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 Clone for Scope

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Deref for Scope

Source§

type Target = Scope

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.