pub struct Line {
pub tag: Rc<Cell<char>>,
pub text: Rc<String>,
/* private fields */
}
Expand description
Text data and metadata for a single line of text
Note the Rc<Cell>s placed around internal variables we wish to share
between points in history while allowing modification, both in that Rc and
without &mut access to the line. This is to let [History] enforce use
of [History::current_mut] to edit the text, while allowing changes to
other data using [History::current] (which doesn’t create undo snapshots).
The tag set on the given line
It is stored in an Rc| to have a shared overwriteable tag for all
historical instances of the line. |
The text data for a given line
It is stored in an Rc as a CoW mechanism, since it allows a shared
allocation for historical states with the same text data while
preventing modification of that shared state. To modify, create a new
String with the data you want and put it in a new Rc in this field.
Formats the value using the given formatter.
Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used
by ==.
This method tests for !=. The default implementation is almost always
sufficient, and should not be overridden without very good reason.
Gets the type name of self
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns
true if the boxed type is the same as
T.
Read more
Forward to the method defined on the type Any.
Forward to the method defined on the type Any.
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 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.