summaryrefslogtreecommitdiffstats
path: root/src/query.rs
blob: a1ccb7d62201faab0abc6ca74fe331242e341042 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use std::str::FromStr;

use crate::tokenizer::Token;

pub struct Query {
    token: Token,
}

impl Query {
    pub(crate) fn token(&self) -> &Token {
        &self.token
    }
}

impl FromStr for Query {
    type Err = crate::error::Error;
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        crate::tokenizer::tokenize_with_seperator(s, '.')
            .map(|token| Query { token })
    }
}