pub struct StringInput<'a> { /* private fields */ }
Expand description
Implementation of Input.
Implementations§
source§impl<'a> StringInput<'a>
impl<'a> StringInput<'a>
sourcepub fn new(src: &'a str, start: BytePos, end: BytePos) -> Self
pub fn new(src: &'a str, start: BytePos, end: BytePos) -> Self
start
and end
can be arbitrary value, but start should be less than
or equal to end.
swc
get this value from [SourceMap] because code generator depends on
some methods of [SourceMap].
If you are not going to use methods from
[SourceMap], you may use any value.
pub fn as_str(&self) -> &str
pub fn bump_bytes(&mut self, n: usize)
Trait Implementations§
source§impl<'a> Clone for StringInput<'a>
impl<'a> Clone for StringInput<'a>
source§fn clone(&self) -> StringInput<'a>
fn clone(&self) -> StringInput<'a>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<'a> From<&'a SourceFile> for StringInput<'a>
impl<'a> From<&'a SourceFile> for StringInput<'a>
Creates an Input from SourceFile. This is an alias for
ⓘ
StringInput::new(&fm.src, fm.start_pos, fm.end_pos)
source§fn from(fm: &'a SourceFile) -> Self
fn from(fm: &'a SourceFile) -> Self
Converts to this type from the input type.
source§impl<'a> Input for StringInput<'a>
impl<'a> Input for StringInput<'a>
fn cur(&mut self) -> Option<char>
fn peek(&mut self) -> Option<char>
fn peek_ahead(&mut self) -> Option<char>
fn bump(&mut self)
source§fn cur_as_ascii(&mut self) -> Option<u8>
fn cur_as_ascii(&mut self) -> Option<u8>
Returns None if it’s end of input or current character is not an
ascii character.
fn is_at_start(&self) -> bool
fn last_pos(&self) -> BytePos
fn slice(&mut self, start: BytePos, end: BytePos) -> &str
source§fn uncons_while<F>(&mut self, pred: F) -> &str
fn uncons_while<F>(&mut self, pred: F) -> &str
Takes items from stream, testing each one with predicate. returns the
range of items which passed predicate.
source§fn find<F>(&mut self, pred: F) -> Option<BytePos>
fn find<F>(&mut self, pred: F) -> Option<BytePos>
This method modifies [last_pos()] and [cur_pos()].
fn reset_to(&mut self, to: BytePos)
source§fn is_byte(&mut self, c: u8) -> bool
fn is_byte(&mut self, c: u8) -> bool
Implementors can override the method to make it faster. Read more
Auto Trait Implementations§
impl<'a> Freeze for StringInput<'a>
impl<'a> RefUnwindSafe for StringInput<'a>
impl<'a> Send for StringInput<'a>
impl<'a> Sync for StringInput<'a>
impl<'a> Unpin for StringInput<'a>
impl<'a> UnwindSafe for StringInput<'a>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more