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>
impl<'a, T: SourceCursorSink<'a>> CursorOverlaySink<'a, T>
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>
impl<'a, T: SourceCursorSink<'a>> CursorSink for CursorOverlaySink<'a, T>
Source§impl<'a, T: Debug + SourceCursorSink<'a>> Debug for CursorOverlaySink<'a, T>
impl<'a, T: Debug + SourceCursorSink<'a>> Debug for CursorOverlaySink<'a, T>
Source§impl<'a, T: SourceCursorSink<'a>> SourceCursorSink<'a> for CursorOverlaySink<'a, T>
impl<'a, T: SourceCursorSink<'a>> SourceCursorSink<'a> for CursorOverlaySink<'a, T>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more