Skip to main content

InputStream

Struct InputStream 

Source
pub struct InputStream<'input> { /* 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§

Source§

impl<'input> InputStream<'input>

Source

pub fn new(data_raw: &'input str) -> Self

Creates new InputStream over borrowed data

Source

pub fn reset(&mut self)

Resets input stream to start from the beginning of this slice

Trait Implementations§

Source§

impl<'input> CharStream<'input> for InputStream<'input>

Source§

fn get_text(&self, start: isize, stop: isize) -> Cow<'input, str>

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
Source§

impl<'input> Debug for InputStream<'input>

Source§

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

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

impl IntStream for InputStream<'_>

Source§

fn consume(&mut self)

Consumes the current symbol in the stream. Advances this stream to the next element. Read more
Source§

fn la(&mut self, offset: isize) -> i32

Lookaheads (or loopbacks if i is negative) Read more
Source§

fn mark(&mut self) -> isize

After this call subsequent calls to seek must succeed if seek index is greater than mark index Read more
Source§

fn release(&mut self, _marker: isize)

Releases marker
Source§

fn index(&self) -> isize

Returns current position of the input stream Read more
Source§

fn seek(&mut self, index: isize)

Put stream back in state it was when it was in index position Read more
Source§

fn size(&self) -> isize

Returns the total number of symbols in the stream.
Source§

fn get_source_name(&self) -> String

Returns name of the source this stream operates over if any

Auto Trait Implementations§

§

impl<'input> Freeze for InputStream<'input>

§

impl<'input> RefUnwindSafe for InputStream<'input>

§

impl<'input> Send for InputStream<'input>

§

impl<'input> Sync for InputStream<'input>

§

impl<'input> Unpin for InputStream<'input>

§

impl<'input> UnwindSafe for InputStream<'input>

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.