Struct swc_ecma_parser::StringInput
source · 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) -> 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)
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) -> StringInput<'a>
fn from(fm: &'a SourceFile) -> StringInput<'a>
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>
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
source§fn 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.
source§fn 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()].
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> 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> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,
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> LayoutRaw for T
impl<T> LayoutRaw for T
source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.