Struct dioxus_core::scope::Scope [−][src]
Every component in Dioxus is represented by a Scope.
Scopes contain the state for hooks, the component’s props, and other lifecycle information.
Scopes are allocated in a generational arena. As components are mounted/unmounted, they will replace slots of dead components. The actual contents of the hooks, though, will be allocated with the standard allocator. These should not allocate as frequently.
Fields
hooks: RefCell<Vec<*mut Hook>>hook_arena: Arena<Hook>parent: Option<Index>frames: ActiveFramelisteners: Vec<*const dyn Fn(VirtualEvent)>props: Box<dyn Any>caller: *const ()Implementations
impl Scope[src]
pub fn new<'a, P1, P2: 'static>(
f: FC<P1>,
props: P1,
parent: Option<Index>
) -> Self[src]
f: FC<P1>,
props: P1,
parent: Option<Index>
) -> Self
pub fn run<'bump, PLocked: Sized + 'static>(&'bump mut self)[src]
Create a new context and run the component with references from the Virtual Dom This function downcasts the function pointer based on the stored props_type
Props is ?Sized because we borrow the props and don’t need to know the size. P (sized) is used as a marker (unsized)
pub fn new_frame<'bump>(&'bump self) -> &'bump VNode<'bump>[src]
Accessor to get the root node and its children (safely)
Scope is self-referntial, so we are forced to use the ’static lifetime to cheat
pub fn old_frame<'bump>(&'bump self) -> &'bump VNode<'bump>[src]
Auto Trait Implementations
impl !RefUnwindSafe for Scope
impl !Send for Scope
impl !Sync for Scope
impl Unpin for Scope
impl !UnwindSafe for Scope
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Erased for T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,