noa_parser/bytes/components/
until_end.rs

1use crate::bytes::token::Token;
2use crate::errors::ParseResult;
3use crate::peek::{PeekResult, Peekable, UntilEnd};
4use crate::scanner::Scanner;
5
6impl<'a> Peekable<'a, u8, Token, Token> for UntilEnd<u8> {
7    /// Peeks at the current position of the `Scanner` until it reaches the end
8    /// of the data.
9    ///
10    /// # Arguments
11    ///
12    /// * `data` - The `Scanner` to use when matching.
13    ///
14    /// # Returns
15    ///
16    /// A `PeekResult` where the `end_slice` is the current position of the
17    /// `Scanner`, and `start` and `end` are both `()`.
18    fn peek(&self, data: &Scanner<'a, u8>) -> ParseResult<PeekResult<Token, Token>> {
19        Ok(PeekResult::Found {
20            end_slice: data.remaining().len(),
21            start: Token::Whitespace,
22            end: Token::Whitespace,
23        })
24    }
25}