Type Alias SourceFileInput
pub type SourceFileInput<'a> = StringInput<'a>;
Available on crate feature
__common
only.Aliased Type§
struct SourceFileInput<'a> { /* private fields */ }
Implementations
§impl<'a> StringInput<'a>
impl<'a> StringInput<'a>
pub fn new(src: &'a str, start: BytePos, end: BytePos) -> StringInput<'a>
pub fn new(src: &'a str, start: BytePos, end: BytePos) -> StringInput<'a>
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)
pub fn start_pos(&self) -> BytePos
pub fn end_pos(&self) -> BytePos
Trait Implementations
§impl<'a> Clone for StringInput<'a>
impl<'a> Clone for StringInput<'a>
§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 more§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)
§fn from(fm: &'a SourceFile) -> StringInput<'a>
fn from(fm: &'a SourceFile) -> StringInput<'a>
Converts to this type from the input type.
§impl Input for StringInput<'_>
impl Input for StringInput<'_>
fn cur(&mut self) -> Option<char>
fn peek(&mut self) -> Option<char>
fn peek_ahead(&mut self) -> Option<char>
§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 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.
§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()].