Struct silkenweb_reactive::signal::Signal[][src]

pub struct Signal<T>(_);

A Signal is like a varible, but it can update it’s dependencies when it changes.

let x = Signal::new(0);
let next_x = x.read().map(|x| x + 1);
assert_eq!(*next_x.current(), 1);
x.write().set(2);
assert_eq!(*next_x.current(), 3);

Implementations

impl<T: 'static> Signal<T>[src]

pub fn new(initial: T) -> Self[src]

pub fn read(&self) -> ReadSignal<T>[src]

pub fn write(&self) -> WriteSignal<T>[src]

Trait Implementations

impl<T> Clone for Signal<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for Signal<T>

impl<T> !Send for Signal<T>

impl<T> !Sync for Signal<T>

impl<T> Unpin for Signal<T>

impl<T> !UnwindSafe for Signal<T>

Blanket Implementations

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

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

impl<T> BorrowMut<T> for T where
    T: ?Sized
[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.