Skip to main content

Selector

Struct Selector 

Source
pub struct Selector<K>
where K: Clone + Eq + Hash + 'static,
{ /* private fields */ }
Expand description

O(1) keyed reactive selector notifying only the previously selected and newly selected keys.

Implementations§

Source§

impl<K> Selector<K>
where K: Clone + Eq + Hash + 'static,

Keyed O(1) selection operations for Selector<K>.

Source

pub fn new<F>(source: F) -> Self
where F: FnMut() -> K + 'static,

Creates a selector tracking the key returned by source.

§Arguments
  • F - Reactive key producer closure.
§Returns
  • Self - Selector instance supporting O(1) per-key selection checks.
Source

pub fn is_selected(&self, key: K) -> bool

Reactively returns whether key is currently selected, subscribing only to key.

§Arguments
  • &Self - Selector reference.
  • K - Key to test for active selection.
§Returns
  • bool - True when key equals the active selected key.
Source

pub fn dispose(&self)

Disposes the selector’s watcher effect and per-key signals.

§Arguments
  • &Self - Selector to dispose.

Trait Implementations§

Source§

impl<K> Debug for Selector<K>
where K: Clone + Eq + Hash + 'static,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the struct fields as a debug struct, skipping excluded fields.

§Arguments
  • &mut ::std::fmt::Formatter<'_> - The formatter to write the representation into.
§Returns
  • ::std::fmt::Result - Success or failure of the formatting operation.

Auto Trait Implementations§

§

impl<K> !RefUnwindSafe for Selector<K>

§

impl<K> !Send for Selector<K>

§

impl<K> !Sync for Selector<K>

§

impl<K> !UnwindSafe for Selector<K>

§

impl<K> Forget for Selector<K>

§

impl<K> Freeze for Selector<K>
where Rc<RefCell<SelectorState<K>>>: Freeze,

§

impl<K> Move for Selector<K>

§

impl<K> Unpin for Selector<K>
where Rc<RefCell<SelectorState<K>>>: Unpin,

§

impl<K> UnsafeUnpin for Selector<K>
where Rc<RefCell<SelectorState<K>>>: UnsafeUnpin,

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.