Struct ress::JSBuffer[][src]

pub struct JSBuffer<'a> {
    pub buffer: &'a [u8],
    pub idx: usize,
    pub len: usize,
}

Fields

buffer: &'a [u8]idx: usizelen: usize

Implementations

impl<'a> JSBuffer<'a>[src]

Re-implementation of the std::str::Chars logic

pub fn next_char(&mut self) -> Option<char>[src]

pub fn prev_char(&mut self) -> Option<char>[src]

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

impl<'a> Clone for JSBuffer<'a>[src]

impl<'a> From<&'a str> for JSBuffer<'a>[src]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.