CursorOverlaySink

Struct CursorOverlaySink 

Source
pub struct CursorOverlaySink<'a, T: SourceCursorSink<'a>> { /* private fields */ }
Expand description

This is a CursorSink that wraps a SourceCursorSink, while also taking a CursorOverlaySet. As Cursors get appended into this sink, it will replay those to the underlying SourceCursorSink unless a CursorOverlaySet overlaps the Cursor’s span, at which point the overlay wil be replayed to the underlying SourceCursorSink. This Sink is useful for collecting new Cursors (say from an AST) to overlap (or, say, transform) the underlying base Cursors (read: AST). In other words, writing over the top of the source.

Other than replaying overlays in place of the underyling cursors, no other modifications are made to the Cursors, that is up to the base SourceCursorSink, which can apply additional formatting or logic.

Implementations§

Source§

impl<'a, T: SourceCursorSink<'a>> CursorOverlaySink<'a, T>

Source

pub fn new( source_text: &'a str, overlays: &'a CursorOverlaySet<'a>, sink: T, ) -> Self

Trait Implementations§

Source§

impl<'a, T: SourceCursorSink<'a>> CursorSink for CursorOverlaySink<'a, T>

Source§

fn append(&mut self, c: Cursor)

Source§

impl<'a, T: Debug + SourceCursorSink<'a>> Debug for CursorOverlaySink<'a, T>

Source§

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

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

impl<'a, T: SourceCursorSink<'a>> SourceCursorSink<'a> for CursorOverlaySink<'a, T>

Source§

fn append(&mut self, c: SourceCursor<'a>)

Auto Trait Implementations§

§

impl<'a, T> Freeze for CursorOverlaySink<'a, T>
where T: Freeze,

§

impl<'a, T> !RefUnwindSafe for CursorOverlaySink<'a, T>

§

impl<'a, T> !Send for CursorOverlaySink<'a, T>

§

impl<'a, T> !Sync for CursorOverlaySink<'a, T>

§

impl<'a, T> Unpin for CursorOverlaySink<'a, T>
where T: Unpin,

§

impl<'a, T> !UnwindSafe for CursorOverlaySink<'a, T>

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> 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> 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>,

Source§

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>,

Source§

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.