Struct Binary

Source
pub struct Binary { /* private fields */ }
Expand description

Binary representation of the regulatory Database

Implementations§

Source§

impl Binary

Source

pub fn from_regdb(regdb: &RegDB) -> Result<Self>

Create a Binary representation of the Regulatory DB

§Arguments
  • regdb - reference of a regulatory database
Examples found in repository?
examples/generate-regdb.rs (line 17)
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}
Source

pub fn write_file<P: AsRef<Path>>(&self, path: P) -> Result<()>

Write database to file

§Arguments
  • path - path of the file
Examples found in repository?
examples/generate-regdb.rs (line 19)
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}
Source

pub fn write<T: Write>(&self, writer: T) -> Result<()>

Write database to Writer

§Arguments
  • writer - std::io::Writer to write database to

Trait Implementations§

Source§

impl Debug for Binary

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Binary

§

impl RefUnwindSafe for Binary

§

impl Send for Binary

§

impl Sync for Binary

§

impl Unpin for Binary

§

impl UnwindSafe for Binary

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.