Struct antlr_rust::input_stream::InputStream
source · [−]pub struct InputStream<Data: Deref> { /* private fields */ }
Expand description
Default rust target input stream.
Since Rust uses UTF-8 format which does not support indexing by char,
InputStream<&str>
has slightly different index behavior in compare to java runtime when there are
non-ASCII unicode characters.
If you need it to generate exactly the same indexes as Java runtime, you have to use CodePoint8/16/32BitCharStream
,
which does not use rusts native str
type, so it would do additional conversions and allocations along the way.
Implementations
sourceimpl<Data: ?Sized + InputData> InputStream<Box<Data>>
impl<Data: ?Sized + InputData> InputStream<Box<Data>>
sourceimpl<'a, Data> InputStream<&'a Data> where
Data: ?Sized + InputData,
impl<'a, Data> InputStream<&'a Data> where
Data: ?Sized + InputData,
Trait Implementations
sourceimpl<'a, T> CharStream<&'a [T]> for InputStream<&'a [T]> where
[T]: InputData,
impl<'a, T> CharStream<&'a [T]> for InputStream<&'a [T]> where
[T]: InputData,
sourcefn get_text(&self, a: isize, b: isize) -> &'a [T]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
fn get_text(&self, a: isize, b: isize) -> &'a [T]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
Returns underlying data piece, either slice or owned copy. Panics if provided indexes are invalid Called by parser only on token intervals. This fact can be used by custom implementations Read more
sourceimpl<'a, T> CharStream<Cow<'a, [T]>> for InputStream<&'a [T]> where
[T]: InputData,
impl<'a, T> CharStream<Cow<'a, [T]>> for InputStream<&'a [T]> where
[T]: InputData,
sourceimpl<'a, 'b, T> CharStream<Cow<'b, str>> for InputStream<&'a [T]> where
[T]: InputData,
impl<'a, 'b, T> CharStream<Cow<'b, str>> for InputStream<&'a [T]> where
[T]: InputData,
sourceimpl<'a, T> CharStream<String> for InputStream<&'a [T]> where
[T]: InputData,
impl<'a, T> CharStream<String> for InputStream<&'a [T]> where
[T]: InputData,
sourceimpl<'a, T: From<&'a str>> CharStream<T> for InputStream<&'a str>
impl<'a, T: From<&'a str>> CharStream<T> for InputStream<&'a str>
sourceimpl<T: From<D::Owned>, D: ?Sized + InputData> CharStream<T> for InputStream<Box<D>>
impl<T: From<D::Owned>, D: ?Sized + InputData> CharStream<T> for InputStream<Box<D>>
sourceimpl<Data: Debug + Deref> Debug for InputStream<Data>
impl<Data: Debug + Deref> Debug for InputStream<Data>
sourceimpl<'a, Data: Deref> IntStream for InputStream<Data> where
Data::Target: InputData,
impl<'a, Data: Deref> IntStream for InputStream<Data> where
Data::Target: InputData,
sourcefn consume(&mut self)
fn consume(&mut self)
Consumes the current symbol in the stream. Advances this stream to the next element. Read more
sourcefn mark(&mut self) -> isize
fn mark(&mut self) -> isize
After this call subsequent calls to seek must succeed if seek index is greater than mark index Read more
sourcefn seek(&mut self, index: isize)
fn seek(&mut self, index: isize)
Put stream back in state it was when it was in index
position Read more
sourcefn get_source_name(&self) -> String
fn get_source_name(&self) -> String
Returns name of the source this stream operates over if any
impl<'a, T: 'static> TidAble<'a> for InputStream<&'a T> where
T: ?Sized,
impl<'a, T: 'static> TidAble<'a> for InputStream<Box<T>> where
T: ?Sized,
Auto Trait Implementations
impl<Data> RefUnwindSafe for InputStream<Data> where
Data: RefUnwindSafe,
impl<Data> Send for InputStream<Data> where
Data: Send,
impl<Data> Sync for InputStream<Data> where
Data: Sync,
impl<Data> Unpin for InputStream<Data> where
Data: Unpin,
impl<Data> UnwindSafe for InputStream<Data> where
Data: UnwindSafe,
Blanket Implementations
sourceimpl<T> AnyExt for T where
T: Any + ?Sized,
impl<T> AnyExt for T where
T: Any + ?Sized,
sourcefn downcast_ref<T>(this: &Self) -> Option<&T> where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T> where
T: Any,
Attempts to downcast this to T
behind reference
sourcefn downcast_mut<T>(this: &mut Self) -> Option<&mut T> where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T> where
T: Any,
Attempts to downcast this to T
behind mutable reference
sourcefn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>> where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>> where
T: Any,
Attempts to downcast this to T
behind Rc
pointer
sourcefn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>> where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>> where
T: Any,
Attempts to downcast this to T
behind Arc
pointer
sourcefn downcast_box<T>(
this: Box<Self, Global>
) -> Result<Box<T, Global>, Box<Self, Global>> where
T: Any,
fn downcast_box<T>(
this: Box<Self, Global>
) -> Result<Box<T, Global>, Box<Self, Global>> where
T: Any,
Attempts to downcast this to T
behind Box
pointer
sourcefn downcast_move<T>(this: Self) -> Option<T> where
T: Any,
fn downcast_move<T>(this: Self) -> Option<T> where
T: Any,
Attempts to downcast owned Self
to T
,
useful only in generic context as a workaround for specialization Read more
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T, X> CoerceTo<T> for X where
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for X where
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X, Global>) -> Box<T, Global>ⓘNotable traits for Box<W, Global>impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
sourceimpl<'a, X> TidExt<'a> for X where
X: Tid<'a> + ?Sized,
impl<'a, X> TidExt<'a> for X where
X: Tid<'a> + ?Sized,
sourcefn is<T>(&self) -> bool where
T: Tid<'a>,
fn is<T>(&self) -> bool where
T: Tid<'a>,
Returns true if type behind self is equal to the type of T.
sourcefn downcast_ref<T>(&'b self) -> Option<&'b T> where
T: Tid<'a>,
fn downcast_ref<T>(&'b self) -> Option<&'b T> where
T: Tid<'a>,
Attempts to downcast self to T
behind reference
sourcefn downcast_mut<T>(&'b mut self) -> Option<&'b mut T> where
T: Tid<'a>,
fn downcast_mut<T>(&'b mut self) -> Option<&'b mut T> where
T: Tid<'a>,
Attempts to downcast self to T
behind mutable reference
sourcefn downcast_rc<T>(self: Rc<Self>) -> Result<Rc<T>, Rc<Self>> where
T: Tid<'a>,
fn downcast_rc<T>(self: Rc<Self>) -> Result<Rc<T>, Rc<Self>> where
T: Tid<'a>,
Attempts to downcast self to T
behind Rc
pointer
sourcefn downcast_arc<T>(self: Arc<Self>) -> Result<Arc<T>, Arc<Self>> where
T: Tid<'a>,
fn downcast_arc<T>(self: Arc<Self>) -> Result<Arc<T>, Arc<Self>> where
T: Tid<'a>,
Attempts to downcast self to T
behind Arc
pointer
sourcefn downcast_box<T>(
self: Box<Self, Global>
) -> Result<Box<T, Global>, Box<Self, Global>> where
T: Tid<'a>,
fn downcast_box<T>(
self: Box<Self, Global>
) -> Result<Box<T, Global>, Box<Self, Global>> where
T: Tid<'a>,
Attempts to downcast self to T
behind Box
pointer
sourcefn downcast_move<T>(self) -> Option<T> where
T: Tid<'a>,
fn downcast_move<T>(self) -> Option<T> where
T: Tid<'a>,
Attempts to downcast owned Self
to T
,
useful only in generic context as a workaround for specialization Read more