Struct add_ed::Line

source ·
pub struct Line {
    pub text: LineText,
    /* private fields */
}
Expand description

Text data and metadata for a single line of text

Note that the internal field accessed by .tag() and .set_tag() is shared throughout the historical instances of the Line.

The main way to create, move around or clone Line instances is through PubLine. For this purpose PubLine implements From<&Line> and Line implements From. (Creating a PubLine from a Line is basically free, creating a Line from a PubLine includes some allocations but still cheap.) This is to ensure that the internal pointers that Line uses internally (sharing objects between historical states) aren’t pointing to somewhere they shouldn’t.

Fields§

§text: LineText

The text data for a given line

LineText ensures that the text data is valid for a single line and implements reference counted cloning, allowing easy re-use of the same data (through history, clipboard and even multiple identical lines (depending on how they are created)).

Implementations§

source§

impl Line

source

pub fn tag(&self) -> char

Get the current value of the tag field.

source

pub fn set_tag(&self, new: char)

Set the tag to given character

Note that this changes all historical states of this line.

Trait Implementations§

source§

impl Debug for Line

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&Line> for PubLine

source§

fn from(l: &Line) -> Self

Converts to this type from the input type.
source§

impl From<&PubLine> for Line

source§

fn from(l: &PubLine) -> Self

Converts to this type from the input type.
source§

impl PartialEq for Line

source§

fn eq(&self, other: &Line) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl TryFrom<&str> for Line

§

type Error = LineTextError

The type returned in the event of a conversion error.
source§

fn try_from(t: &str) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for Line

source§

impl StructuralEq for Line

source§

impl StructuralPartialEq for Line

Auto Trait Implementations§

§

impl !RefUnwindSafe for Line

§

impl !Send for Line

§

impl !Sync for Line

§

impl Unpin for Line

§

impl !UnwindSafe for Line

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AsAny for T
where T: Any,

source§

fn as_any(&self) -> &(dyn Any + 'static)

source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

source§

fn type_name(&self) -> &'static str

Gets the type name of self
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Downcast for T
where T: AsAny + ?Sized,

source§

fn is<T>(&self) -> bool
where T: AsAny,

Returns true if the boxed type is the same as T. Read more
source§

fn downcast_ref<T>(&self) -> Option<&T>
where T: AsAny,

Forward to the method defined on the type Any.
source§

fn downcast_mut<T>(&mut self) -> Option<&mut T>
where T: AsAny,

Forward to the method defined on the type Any.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.