[][src]Enum wireless_regdb::lexer::TokType

pub enum TokType {
    String(String),
    Int(usize),
    Colon,
    Equals,
    Minus,
    Comma,
    LParen,
    RParen,
    At,
}

Token Representing content from the txt file format of the binary database

Variants

String(String)

String Token

Int(usize)

Integer represented as usize

Colon
Equals
Minus
Comma
LParen
RParen
At

Single @ Token

Implementations

impl TokType[src]

pub fn parse<P: AsRef<Path>>(file: P) -> Result<Vec<Self>>[src]

Parse a file from filesystem to a Vec of Tokens

Arguments

  • path - path to db.txt on disk

pub fn parse_str(db: &str) -> Result<Vec<Self>>[src]

Parse a string to a Vec of Tokens

Arguments

  • db - string of the database

Example

use wireless_regdb::TokType;
let tokens = TokType::parse_str("wmmrule: ETSI").unwrap();

pub fn get_string(&self) -> Result<String>[src]

Return the string of the token, if the token contains a string

Example

use wireless_regdb::TokType;
let token = TokType::String("hello_world".to_string());
let content = token.get_string().unwrap();

pub fn get_int(&self) -> Result<usize>[src]

Return the usize of the token, if the token contains an integer

Example

use wireless_regdb::TokType;
let token = TokType::Int(1337);
let content = token.get_int().unwrap();

Trait Implementations

impl Clone for TokType[src]

impl Debug for TokType[src]

impl Eq for TokType[src]

impl PartialEq<TokType> for TokType[src]

impl StructuralEq for TokType[src]

impl StructuralPartialEq for TokType[src]

Auto Trait Implementations

impl RefUnwindSafe for TokType

impl Send for TokType

impl Sync for TokType

impl Unpin for TokType

impl UnwindSafe for TokType

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.