Struct flo_binding::RopeBinding [−][src]
A rope binding binds a vector of cells and attributes
It's also possible to use a normal Binding<Vec<_>>
for this purpose. A rope binding has a
couple of advantages though: it can handle very large collections of items and it can notify
only the relevant changes instead of always notifying the entire structure.
Rope bindings are ideal for representing text areas in user interfaces, but can be used for any collection data structure.
Implementations
impl<Cell, Attribute> RopeBinding<Cell, Attribute> where
Cell: 'static + Send + Unpin + Clone + PartialEq,
Attribute: 'static + Send + Sync + Clone + Unpin + PartialEq + Default,
[src]
Cell: 'static + Send + Unpin + Clone + PartialEq,
Attribute: 'static + Send + Sync + Clone + Unpin + PartialEq + Default,
pub fn from_stream<S: 'static + Stream<Item = RopeAction<Cell, Attribute>> + Unpin + Send>(
stream: S
) -> RopeBinding<Cell, Attribute>
[src]
stream: S
) -> RopeBinding<Cell, Attribute>
Creates a new rope binding from a stream of changes
pub fn follow_changes(&self) -> RopeStream<Cell, Attribute>
[src]
Creates a stream that follows the changes to this rope
pub fn len(&self) -> usize
[src]
Returns the number of cells in this rope
pub fn read_cells<'a>(
&'a self,
range: Range<usize>
) -> impl 'a + Iterator<Item = Cell>
[src]
&'a self,
range: Range<usize>
) -> impl 'a + Iterator<Item = Cell>
Reads the cell values for a range in this rope
pub fn read_attributes<'a>(&'a self, pos: usize) -> (Attribute, Range<usize>)
[src]
Returns the attributes set at the specified location and their extent
Trait Implementations
impl<Cell, Attribute> Bound<AttributedRope<Cell, Attribute>> for RopeBinding<Cell, Attribute> where
Cell: 'static + Send + Unpin + Clone + PartialEq,
Attribute: 'static + Send + Sync + Clone + Unpin + PartialEq + Default,
[src]
Cell: 'static + Send + Unpin + Clone + PartialEq,
Attribute: 'static + Send + Sync + Clone + Unpin + PartialEq + Default,
Trait implemented by something that is bound to a value
fn get(&self) -> AttributedRope<Cell, Attribute>
[src]
Retrieves the value stored by this binding
impl<Cell, Attribute> Changeable for RopeBinding<Cell, Attribute> where
Cell: 'static + Send + Unpin + Clone + PartialEq,
Attribute: 'static + Send + Sync + Clone + Unpin + PartialEq + Default,
[src]
Cell: 'static + Send + Unpin + Clone + PartialEq,
Attribute: 'static + Send + Sync + Clone + Unpin + PartialEq + Default,
fn when_changed(&self, what: Arc<dyn Notifiable>) -> Box<dyn Releasable>
[src]
Supplies a function to be notified when this item is changed
This event is only fired after the value has been read since the most recent change. Note that this means if the value is never read, this event may never fire. This behaviour is desirable when deferring updates as it prevents large cascades of 'changed' events occurring for complicated dependency trees.
The releasable that's returned has keep_alive turned off by default, so be sure to store it in a variable or call keep_alive() to keep it around (if the event never seems to fire, this is likely to be the problem)
impl<Cell, Attribute> Clone for RopeBinding<Cell, Attribute> where
Cell: 'static + Send + Unpin + Clone + PartialEq,
Attribute: 'static + Send + Sync + Clone + Unpin + PartialEq + Default,
[src]
Cell: 'static + Send + Unpin + Clone + PartialEq,
Attribute: 'static + Send + Sync + Clone + Unpin + PartialEq + Default,
fn clone(&self) -> RopeBinding<Cell, Attribute>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<Cell, Attribute> Drop for RopeBinding<Cell, Attribute> where
Cell: 'static + Send + Unpin + Clone + PartialEq,
Attribute: 'static + Send + Sync + Clone + Unpin + PartialEq + Default,
[src]
Cell: 'static + Send + Unpin + Clone + PartialEq,
Attribute: 'static + Send + Sync + Clone + Unpin + PartialEq + Default,
Auto Trait Implementations
impl<Cell, Attribute> !RefUnwindSafe for RopeBinding<Cell, Attribute>
[src]
impl<Cell, Attribute> Send for RopeBinding<Cell, Attribute>
[src]
impl<Cell, Attribute> Sync for RopeBinding<Cell, Attribute>
[src]
impl<Cell, Attribute> Unpin for RopeBinding<Cell, Attribute>
[src]
impl<Cell, Attribute> !UnwindSafe for RopeBinding<Cell, Attribute>
[src]
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>,