pub struct ScopeId(pub usize);Expand description
A component’s unique identifier.
ScopeId is a usize that acts a key for the internal slab of Scopes. This means that the key is not unqiue across
time. We do try and guarantee that between calls to wait_for_work, no ScopeIds will be recycled in order to give
time for any logic that relies on these IDs to properly update.
Tuple Fields§
§0: usizeImplementations§
source§impl ScopeId
 
impl ScopeId
sourcepub fn current_scope_id(self) -> Option<ScopeId>
 
pub fn current_scope_id(self) -> Option<ScopeId>
Get the current scope id
sourcepub fn consume_context<T>(self) -> Option<T>where
    T: 'static + Clone,
 
pub fn consume_context<T>(self) -> Option<T>where
    T: 'static + Clone,
Consume context from the current scope
sourcepub fn consume_context_from_scope<T>(self, scope_id: ScopeId) -> Option<T>where
    T: 'static + Clone,
 
pub fn consume_context_from_scope<T>(self, scope_id: ScopeId) -> Option<T>where
    T: 'static + Clone,
Consume context from the current scope
sourcepub fn has_context<T>(self) -> Option<T>where
    T: 'static + Clone,
 
pub fn has_context<T>(self) -> Option<T>where
    T: 'static + Clone,
Check if the current scope has a context
sourcepub fn provide_context<T>(self, value: T) -> Twhere
    T: 'static + Clone,
 
pub fn provide_context<T>(self, value: T) -> Twhere
    T: 'static + Clone,
Provide context to the current scope
sourcepub fn push_future(
    self,
    fut: impl Future<Output = ()> + 'static
) -> Option<Task>
 
pub fn push_future( self, fut: impl Future<Output = ()> + 'static ) -> Option<Task>
Pushes the future onto the poll queue to be polled after the component renders.
sourcepub fn spawn(self, fut: impl Future<Output = ()> + 'static)
 
pub fn spawn(self, fut: impl Future<Output = ()> + 'static)
Spawns the future but does not return the [TaskId]
sourcepub fn generation(self) -> Option<usize>
 
pub fn generation(self) -> Option<usize>
Get the current render since the inception of this component
This can be used as a helpful diagnostic when debugging hooks/renders, etc
sourcepub fn parent_scope(self) -> Option<ScopeId>
 
pub fn parent_scope(self) -> Option<ScopeId>
Get the parent of the current scope if it exists
sourcepub fn needs_update(self)
 
pub fn needs_update(self)
Mark the current scope as dirty, causing it to re-render
sourcepub fn schedule_update(&self) -> Arc<dyn Fn() + Send + Sync>
 
pub fn schedule_update(&self) -> Arc<dyn Fn() + Send + Sync>
Create a subscription that schedules a future render for the reference component. Unlike Self::needs_update, this function will work outside of the dioxus runtime.
§Notice: you should prefer using [dioxus_core::schedule_update_any] and [Self::scope_id]
sourcepub fn in_runtime<T>(self, f: impl FnOnce() -> T) -> T
 
pub fn in_runtime<T>(self, f: impl FnOnce() -> T) -> T
Run a closure inside of scope’s runtime
Trait Implementations§
source§impl<'de> Deserialize<'de> for ScopeId
 
impl<'de> Deserialize<'de> for ScopeId
source§fn deserialize<__D>(
    __deserializer: __D
) -> Result<ScopeId, <__D as Deserializer<'de>>::Error>where
    __D: Deserializer<'de>,
 
fn deserialize<__D>(
    __deserializer: __D
) -> Result<ScopeId, <__D as Deserializer<'de>>::Error>where
    __D: Deserializer<'de>,
source§impl Ord for ScopeId
 
impl Ord for ScopeId
source§impl PartialEq for ScopeId
 
impl PartialEq for ScopeId
source§impl PartialOrd for ScopeId
 
impl PartialOrd for ScopeId
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
 
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read more