pub enum TokType {
String(String),
Int(usize),
Colon,
Equals,
Minus,
Comma,
LParen,
RParen,
At,
}Expand description
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§
Source§impl TokType
impl TokType
Sourcepub fn parse<P: AsRef<Path>>(file: P) -> Result<Vec<Self>>
pub fn parse<P: AsRef<Path>>(file: P) -> Result<Vec<Self>>
Examples found in repository?
examples/generate-regdb.rs (line 13)
4fn main() {
5 if args().len() != 3 {
6 eprintln!("Usage: {} input-file output-file", args().nth(0).unwrap());
7 std::process::exit(-1);
8 }
9
10 let in_file = args().nth(1).unwrap();
11 let out_file = args().nth(2).unwrap();
12
13 let lexer = TokType::parse(in_file).unwrap();
14
15 let db = RegDB::from_lexer(lexer).unwrap();
16
17 let bin_db = Binary::from_regdb(&db).unwrap();
18
19 bin_db.write_file(out_file).unwrap();
20}Sourcepub fn get_string(&self) -> Result<String>
pub fn get_string(&self) -> Result<String>
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();Trait Implementations§
impl Eq for TokType
impl StructuralPartialEq for TokType
Auto Trait Implementations§
impl Freeze for TokType
impl RefUnwindSafe for TokType
impl Send for TokType
impl Sync for TokType
impl Unpin for TokType
impl UnsafeUnpin for TokType
impl UnwindSafe for TokType
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