[][src]Struct yew::html::Scope

pub struct Scope<COMP: Component> { /* fields omitted */ }

A context which allows sending messages to a component.

Implementations

impl<COMP: Component> Scope<COMP>[src]

pub fn get_parent(&self) -> Option<&AnyScope>[src]

Returns the parent scope

pub fn get_component(&self) -> Option<impl Deref<Target = COMP> + '_>[src]

Returns the linked component if available

pub fn send_message<T>(&self, msg: T) where
    T: Into<COMP::Message>, 
[src]

Send a message to the component.

Please be aware that currently this method synchronously schedules a call to the Component interface.

pub fn send_message_batch(&self, messages: Vec<COMP::Message>)[src]

Send a batch of messages to the component.

This is useful for reducing re-renders of the components because the messages are handled together and the view function is called only once if needed.

Please be aware that currently this method synchronously schedules calls to the Component interface.

pub fn callback<F, IN, M>(&self, function: F) -> Callback<IN> where
    M: Into<COMP::Message>,
    F: Fn(IN) -> M + 'static, 
[src]

Creates a Callback which will send a message to the linked component's update method when invoked.

Please be aware that currently the result of this callback synchronously schedules a call to the Component interface.

pub fn callback_once<F, IN, M>(&self, function: F) -> Callback<IN> where
    M: Into<COMP::Message>,
    F: FnOnce(IN) -> M + 'static, 
[src]

Creates a Callback from an FnOnce which will send a message to the linked component's update method when invoked.

Please be aware that currently the result of this callback will synchronously schedule calls to the Component interface.

pub fn batch_callback<F, IN>(&self, function: F) -> Callback<IN> where
    F: Fn(IN) -> Vec<COMP::Message> + 'static, 
[src]

Creates a Callback which will send a batch of messages back to the linked component's update method when invoked.

Please be aware that currently the results of these callbacks will synchronously schedule calls to the Component interface.

pub fn batch_callback_once<F, IN>(&self, function: F) -> Callback<IN> where
    F: FnOnce(IN) -> Vec<COMP::Message> + 'static, 
[src]

Creates a Callback from an FnOnce which will send a batch of messages back to the linked component's update method when invoked.

Please be aware that currently the results of these callbacks will synchronously schedule calls to the Component interface.

Trait Implementations

impl<COMP: Component> Clone for Scope<COMP>[src]

impl<COMP: Component> Debug for Scope<COMP>[src]

impl<COMP: Component> From<Scope<COMP>> for AnyScope[src]

Auto Trait Implementations

impl<COMP> !RefUnwindSafe for Scope<COMP>

impl<COMP> !Send for Scope<COMP>

impl<COMP> !Sync for Scope<COMP>

impl<COMP> Unpin for Scope<COMP>

impl<COMP> !UnwindSafe for Scope<COMP>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CloneAny for T where
    T: Clone + Any
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.