pub struct Entry<'a> {
    pub reference: TSNode<'a>,
    pub text: &'a str,
    pub start_position: Point,
    pub end_position: Point,
    pub kind_id: u16,
}
Expand description

A mapping between a tree-sitter node and the text it corresponds to

This is also all of the metadata the diff rendering interface has access to, and also defines the data that will be output by the JSON serializer.

Fields§

§reference: TSNode<'a>

The node an entry in the diff vector refers to

We keep a reference to the leaf node so that we can easily grab the text and other metadata surrounding the syntax

§text: &'a str

A reference to the text the node refers to

This is different from the source_text that the AstVector refers to, as the entry only holds a reference to the specific range of text that the node covers.

§start_position: Point

The entry’s start position in the document.

§end_position: Point

The entry’s end position in the document.

§kind_id: u16

The cached kind_id from the TSNode reference.

Caching it here saves some time because it is queried repeatedly later.

Implementations§

source§

impl<'a> Entry<'a>

source

pub fn start_position(&self) -> Point

Get the start position of an entry

source

pub fn end_position(&self) -> Point

Get the end position of an entry

Trait Implementations§

source§

impl<'a> Clone for Entry<'a>

source§

fn clone(&self) -> Entry<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for Entry<'a>

source§

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

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

impl<'a> From<VectorLeaf<'a>> for Entry<'a>

source§

fn from(leaf: VectorLeaf<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> FromIterator<Entry<'a>> for HunkAppender<'a>

source§

fn from_iter<T>(iter: T) -> Selfwhere T: IntoIterator<Item = Entry<'a>>,

Create an instance of Hunks from an iterator over entries.

The user is responsible for making sure that the hunks are in proper order, otherwise this constructor may panic.

source§

impl<'a> PartialEq<Entry<'a>> for Entry<'a>

source§

fn eq(&self, other: &Entry<'_>) -> 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<'a> Serialize for Entry<'a>

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<'a> Copy for Entry<'a>

source§

impl<'a> Eq for Entry<'a>

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Entry<'a>

§

impl<'a> !Send for Entry<'a>

§

impl<'a> !Sync for Entry<'a>

§

impl<'a> Unpin for Entry<'a>

§

impl<'a> UnwindSafe for Entry<'a>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.