Trait gluon_base::source::Source

source ·
pub trait Source {
    // Required methods
    fn new(s: &str) -> Self
       where Self: Sized;
    fn location(&self, byte: BytePos) -> Option<Location>;
    fn span(&self) -> Span<BytePos>;
    fn src(&self) -> &str;
    fn src_slice(&self, span: Span<BytePos>) -> &str;
    fn byte_index(&self, line: Line, column: Column) -> Option<BytePos>;
    fn line_number_at_byte(&self, pos: BytePos) -> Option<Line>;
    fn comment_start_before(&self, end: BytePos) -> BytePos;
    fn comments_between(&self, span: Span<BytePos>) -> CommentIter<'_> ;
}

Required Methods§

source

fn new(s: &str) -> Self
where Self: Sized,

source

fn location(&self, byte: BytePos) -> Option<Location>

source

fn span(&self) -> Span<BytePos>

source

fn src(&self) -> &str

source

fn src_slice(&self, span: Span<BytePos>) -> &str

source

fn byte_index(&self, line: Line, column: Column) -> Option<BytePos>

source

fn line_number_at_byte(&self, pos: BytePos) -> Option<Line>

source

fn comment_start_before(&self, end: BytePos) -> BytePos

Returns the starting position of any comments and whitespace before end

source

fn comments_between(&self, span: Span<BytePos>) -> CommentIter<'_>

Trait Implementations§

source§

impl<'a, I, A> ToDoc<'a, Arena<'a, A>, A, &'a dyn Source> for ArcType<I>
where I: AsRef<str> + AsId<I>, A: Clone,

source§

fn to_doc( &'a self, arena: &'a Arena<'a, A>, source: &'a dyn Source ) -> DocBuilder<'a, Arena<'a, A>, A>

Implementations on Foreign Types§

source§

impl Source for ()

Implementors§