Struct maple_core::prelude::SignalVec [−][src]
A reactive Vec
.
This is more effective than using a Signal<Vec>
because it allows fine grained
reactivity within the Vec
.
Implementations
impl<T: 'static> SignalVec<T>
[src]
pub fn new() -> Self
[src]
Create a new empty SignalVec
.
pub fn with_values(values: Vec<T>) -> Self
[src]
Create a new SignalVec
with existing values from a Vec
.
pub fn changes(&self) -> &Rc<RefCell<Vec<VecDiff<T>>>>
[src]
Get the current pending changes that will be applied to the SignalVec
.
pub fn inner_signal(&self) -> &Signal<RefCell<Vec<T>>>
[src]
Returns the inner backing Signal
used to store the data. This method should used with
care as unintentionally modifying the Vec
will not trigger any updates and cause
potential future problems.
pub fn replace(&self, values: Vec<T>)
[src]
pub fn insert(&self, index: usize, value: T)
[src]
pub fn update(&self, index: usize, value: T)
[src]
pub fn remove(&self, index: usize)
[src]
pub fn swap(&self, index1: usize, index2: usize)
[src]
pub fn push(&self, value: T)
[src]
pub fn pop(&self)
[src]
pub fn clear(&self)
[src]
pub fn map<U: Clone>(&self, f: impl Fn(&T) -> U + 'static) -> SignalVec<U>
[src]
Creates a derived SignalVec
.
Example
use maple_core::prelude::*; let my_vec = SignalVec::with_values(vec![1, 2, 3]); let squared = my_vec.map(|x| *x * *x); assert_eq!(*squared.inner_signal().get().borrow(), vec![1, 4, 9]); my_vec.push(4); assert_eq!(*squared.inner_signal().get().borrow(), vec![1, 4, 9, 16]); my_vec.swap(0, 1); assert_eq!(*squared.inner_signal().get().borrow(), vec![4, 1, 9, 16]);
impl SignalVec<TemplateResult>
[src]
pub fn template_list(&self) -> TemplateList
[src]
Create a TemplateList
from the SignalVec
.
impl<T: 'static + Clone> SignalVec<T>
[src]
Trait Implementations
impl<T: 'static> Clone for SignalVec<T>
[src]
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: 'static> Default for SignalVec<T>
[src]
impl From<SignalVec<TemplateResult>> for TemplateList
[src]
fn from(templates: SignalVec<TemplateResult>) -> Self
[src]
Auto Trait Implementations
impl<T> !RefUnwindSafe for SignalVec<T>
impl<T> !Send for SignalVec<T>
impl<T> !Sync for SignalVec<T>
impl<T> Unpin for SignalVec<T>
impl<T> !UnwindSafe for SignalVec<T>
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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>,