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

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

Generates a rope binding by tracking a mutable binding

Creates a new rope binding from a stream of changes

Creates a rope binding that entirely replaces its set of cells by following a computed value (the attributes will always have their default values when using this method)

Returns the number of cells in this rope

Reads the cell values for a range in this rope

Returns the attributes set at the specified location and their extent

Similar to computed, but instead of always replacing the entire rope, replaces only the sections that are different between the two values.

This currently stores up to three copies of the list of cells (generally only two, but up to three while computing diffs). This is not efficient for sending edits, but useful when they’re not easily known. Use RopeBindingMut to send edits as they arrive instead.

In spite of this, this is still useful when updating something like a user interface where only the changes should be sent to the user, or for generating edit lists when the data source is not already formatted in a suitable form.

Trait Implementations

Trait implemented by something that is bound to a value

Retrieves the value stored by this binding

Creates a stream that follows the changes to this rope

Creates a stream that follows the changes to this rope

The stream will continue even if the rope binding is dropped (this is possible for RopeBinding as RopeBinding itself might be following a stream)

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)

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.