Struct flo_binding::RopeBinding[][src]

pub struct RopeBinding<Cell, Attribute> where
    Cell: 'static + Send + Unpin + Clone + PartialEq,
    Attribute: 'static + Send + Sync + Unpin + Clone + PartialEq + Default
{ /* fields omitted */ }

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]

pub fn from_stream<S: 'static + Stream<Item = RopeAction<Cell, Attribute>> + Unpin + Send>(
    stream: S
) -> RopeBinding<Cell, Attribute>
[src]

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]

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]

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]

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]

impl<Cell, Attribute> Drop for RopeBinding<Cell, Attribute> where
    Cell: 'static + Send + Unpin + Clone + PartialEq,
    Attribute: 'static + Send + Sync + Clone + Unpin + PartialEq + Default
[src]

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]

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.