Struct swc_common::input::StringInput
source · [−]pub struct StringInput<'a> { /* private fields */ }
Expand description
Implementation of Input.
Implementations
sourceimpl<'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.
Trait Implementations
sourceimpl<'a> Clone for StringInput<'a>
impl<'a> Clone for StringInput<'a>
sourcefn clone(&self) -> StringInput<'a>
fn clone(&self) -> StringInput<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<'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)
sourcefn from(fm: &'a SourceFile) -> Self
fn from(fm: &'a SourceFile) -> Self
Converts to this type from the input type.
sourceimpl<'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>
sourcefn is_str(&self, s: &str) -> bool
fn is_str(&self, s: &str) -> bool
Implementors can override the method to make it faster. Read more
fn bump(&mut self)
fn is_at_start(&self) -> bool
fn last_pos(&self) -> BytePos
fn slice(&mut self, start: BytePos, end: BytePos) -> &str
sourcefn uncons_while<F>(&mut self, pred: F) -> &strwhere
F: FnMut(char) -> bool,
fn uncons_while<F>(&mut self, pred: F) -> &strwhere
F: FnMut(char) -> bool,
Takes items from stream, testing each one with predicate. returns the
range of items which passed predicate. Read more
sourcefn find<F>(&mut self, pred: F) -> Option<BytePos>where
F: FnMut(char) -> bool,
fn find<F>(&mut self, pred: F) -> Option<BytePos>where
F: FnMut(char) -> bool,
This method modifies [last_pos()] and [cur_pos()].
fn reset_to(&mut self, to: BytePos)
sourcefn 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> 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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