RadioSliceMut

Struct RadioSliceMut 

Source
pub struct RadioSliceMut<Value, SliceValue, Channel>
where Channel: RadioChannel<Value>, Value: 'static, SliceValue: 'static,
{ /* private fields */ }
Expand description

A mutable slice of a portion of the global radio state.

Like RadioSlice, components only re-render when the specific portion changes.

§Example

let mut count_slice = radio.slice_mut(AppChannel::Count, |state| &mut state.count);
child_component(count_slice)

Implementations§

Source§

impl<Value, SliceValue, Channel> RadioSliceMut<Value, SliceValue, Channel>
where Channel: RadioChannel<Value>, SliceValue: 'static,

Source

pub fn read(&self) -> ReadRef<'_, SliceValue>

Read the slice value and subscribe to changes.

Source

pub fn read_unchecked(&self) -> ReadRef<'static, SliceValue>

Read the slice value and subscribe to changes, with ’static lifetime.

Source

pub fn peek(&self) -> ReadRef<'_, SliceValue>

Read the slice value without subscribing.

Source

pub fn peek_unchecked(&self) -> ReadRef<'static, SliceValue>

Read the slice value without subscribing, with ’static lifetime.

Source

pub fn write_unchecked(&self) -> WriteRef<'static, SliceValue>

Write the slice value, with ’static lifetime.

Source

pub fn write_unchecked_no_notify(&self) -> WriteRef<'static, SliceValue>

Write the slice value without notifying.

Source

pub fn notify(&self)

Notify listeners for this slice’s channel.

Source

pub fn write(&mut self) -> WriteRef<'_, SliceValue>

Write the slice value.

Trait Implementations§

Source§

impl<Value, SliceValue, Channel> Clone for RadioSliceMut<Value, SliceValue, Channel>
where Channel: RadioChannel<Value>, SliceValue: 'static,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: 'static, Value: 'static, Channel: RadioChannel<Value> + 'static> IntoReadable<T> for RadioSliceMut<Value, T, Channel>

Source§

impl<T: 'static, Value: 'static, Channel: RadioChannel<Value> + 'static> IntoWritable<T> for RadioSliceMut<Value, T, Channel>

Source§

impl<Value, SliceValue, Channel> PartialEq for RadioSliceMut<Value, SliceValue, Channel>
where Channel: RadioChannel<Value>, SliceValue: 'static,

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl<Value, SliceValue, Channel> Freeze for RadioSliceMut<Value, SliceValue, Channel>
where Channel: Freeze,

§

impl<Value, SliceValue, Channel> !RefUnwindSafe for RadioSliceMut<Value, SliceValue, Channel>

§

impl<Value, SliceValue, Channel> !Send for RadioSliceMut<Value, SliceValue, Channel>

§

impl<Value, SliceValue, Channel> !Sync for RadioSliceMut<Value, SliceValue, Channel>

§

impl<Value, SliceValue, Channel> Unpin for RadioSliceMut<Value, SliceValue, Channel>
where Channel: Unpin, SliceValue: Unpin, Value: Unpin,

§

impl<Value, SliceValue, Channel> !UnwindSafe for RadioSliceMut<Value, SliceValue, Channel>

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
§

impl<T> ComponentProps for T
where T: Any + PartialEq,

§

fn changed(&self, other: &(dyn ComponentProps + 'static)) -> bool

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more