Struct ress::JSBuffer [−][src]
Fields
buffer: &'a [u8]
idx: usize
len: usize
Implementations
impl<'a> JSBuffer<'a>
[src]
Re-implementation of the std::str::Chars logic
impl<'a> JSBuffer<'a>
[src]
pub fn new(buffer: &'a [u8]) -> Self
[src]
pub fn at_end(&self) -> bool
[src]
Check if the buffer is at or past the end of the bytes provided
pub fn look_ahead_matches(&self, s: &[u8]) -> bool
[src]
Check if the next few bytes match the provided bytes
pub fn look_ahead_byte_matches(&self, b: u8) -> bool
[src]
Check if the next byte matches a single byte provided
pub fn skip(&mut self, count: usize)
[src]
Skip the number of characters provided note: these are full unicode characters, not just bytes
pub fn skip_bytes(&mut self, count: usize)
[src]
Skip a single byte
note: this can cause the buffer to become unaligned
be sure to always know the character you are skipping
is 1 byte wide or use skip
instead when unsure
pub fn at_whitespace(&mut self) -> bool
[src]
check if current char is a valid js whitespace character
pub fn at_new_line(&mut self) -> bool
[src]
Check of the look ahead character is a valid js new line character
pub fn at_binary(&self) -> bool
[src]
check if the look ahead character is 0
or 1
pub fn at_decimal(&self) -> bool
[src]
check if the look ahead character is a number
between 0
and 9
, inclusive
pub fn at_octal(&self) -> bool
[src]
check if the look ahead character is a number
between 0
and 7
, inclusive
pub fn at_hex(&self) -> bool
[src]
check if the look ahead character is a number
between 0
and 9
or a
and f
or A
and F
, inclusive
pub fn peek_char(&mut self) -> Option<char>
[src]
Peek forward 1 char with out updating the
idx
to this new position.
note: this will still cost the same amount
of work as next_char
but cleans up the
book keeping for you
pub fn skip_back_bytes(&mut self, count: usize)
[src]
Skip backwards a number of bytes
note: this can cause the buffer to become unaligned
be sure to always know the character you are skipping
is [count] bytes wide or use skip
instead when unsure
the right width is skipped
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for JSBuffer<'a>
impl<'a> Send for JSBuffer<'a>
impl<'a> Sync for JSBuffer<'a>
impl<'a> Unpin for JSBuffer<'a>
impl<'a> UnwindSafe for JSBuffer<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,