pub struct DefaultTokenizer;
Expand description
DefaultTokenizer have a format query likes :
// [0].test.[1]
// test.test.[1]
Trait Implementations§
Source§impl Tokenizer for DefaultTokenizer
impl Tokenizer for DefaultTokenizer
Source§fn index_parse(key: &str) -> Result<usize, IndexError>
fn index_parse(key: &str) -> Result<usize, IndexError>
Parse index array.
- should starts and end with ‘[’ and ‘]’. No space allowed.
use querable::{types::Tokenizer, default::DefaultTokenizer, error::{IndexError}};
assert_eq!(DefaultTokenizer::index_parse("[]"), Err(IndexError::ParseError(String::from("[]"))));
- index should be an integer, specificially, in the range of usize.
use querable::{types::Tokenizer, default::DefaultTokenizer};
assert!(DefaultTokenizer::index_parse("[x]").is_err());
Source§fn dict_parse(key: &str) -> Result<State<'_>, KeyError>
fn dict_parse(key: &str) -> Result<State<'_>, KeyError>
Parse key/path index.
- shouldn’t be an empty string or being prefixed & suffixed with empty string.
use querable::{types::Tokenizer, default::DefaultTokenizer, error::{KeyError}};
assert_eq!(DefaultTokenizer::dict_parse(" .test"), Err(KeyError::ParseError(String::from(" "))));
assert_eq!(DefaultTokenizer::dict_parse(""), Err(KeyError::EmptyKey));
Auto Trait Implementations§
impl Freeze for DefaultTokenizer
impl RefUnwindSafe for DefaultTokenizer
impl Send for DefaultTokenizer
impl Sync for DefaultTokenizer
impl Unpin for DefaultTokenizer
impl UnwindSafe for DefaultTokenizer
Blanket Implementations§
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