Skip to main content

Parser

Struct Parser 

Source
pub struct Parser<'a, L> { /* private fields */ }
Expand description

Parser for the ASCII version of the AIGER file format.

Implementations§

Source§

impl<'a, L> Parser<'a, L>
where L: Lit,

Source

pub fn from_buf_reader( buf_reader: BufReader<impl Read + 'a>, config: Config, ) -> Result<Self, ParseError>

Creates a parser reading from a BufReader.

Source

pub fn from_read( read: impl Read + 'a, config: Config, ) -> Result<Self, ParseError>

Creates a parser reading from a Read instance.

If the Read instance is a BufReader, it is better to use from_buf_reader to avoid unnecessary double buffering of the data.

Examples found in repository?
examples/roundtrip_aig_buffered.rs (line 15)
11fn main_err() -> Result<(), ParseError> {
12    let stdin = std::io::stdin();
13    let stdout = std::io::stdout();
14
15    let aig_reader = binary::Parser::<u32>::from_read(stdin.lock(), binary::Config::default())?;
16
17    let aig = aig_reader.parse()?;
18
19    let mut aag_writer = DeferredWriter::from_write(stdout.lock());
20    let aag_writer = ascii::Writer::<u32>::new(&mut aag_writer);
21
22    aag_writer.write_ordered_aig(&aig);
23    Ok(())
24}
Source

pub fn from_boxed_dyn_read( read: Box<dyn Read + 'a>, config: Config, ) -> Result<Self, ParseError>

Creates a parser reading from a boxed Read instance.

If the Read instance is a BufReader, it is better to use from_buf_reader to avoid unnecessary double buffering of the data.

Source

pub fn new(reader: LineReader<'a>, _config: Config) -> Result<Self, ParseError>

Creates a parser reading from a LineReader.

Source

pub fn latches(self) -> Result<ParseLatches<'a, L>, ParseError>

Source

pub fn header(&self) -> &Header

Source

pub fn parse(self) -> Result<OrderedAig<L>, ParseError>

Examples found in repository?
examples/roundtrip_aig_buffered.rs (line 17)
11fn main_err() -> Result<(), ParseError> {
12    let stdin = std::io::stdin();
13    let stdout = std::io::stdout();
14
15    let aig_reader = binary::Parser::<u32>::from_read(stdin.lock(), binary::Config::default())?;
16
17    let aig = aig_reader.parse()?;
18
19    let mut aag_writer = DeferredWriter::from_write(stdout.lock());
20    let aag_writer = ascii::Writer::<u32>::new(&mut aag_writer);
21
22    aag_writer.write_ordered_aig(&aig);
23    Ok(())
24}

Auto Trait Implementations§

§

impl<'a, L> !RefUnwindSafe for Parser<'a, L>

§

impl<'a, L> !Send for Parser<'a, L>

§

impl<'a, L> !Sync for Parser<'a, L>

§

impl<'a, L> !UnwindSafe for Parser<'a, L>

§

impl<'a, L> Freeze for Parser<'a, L>

§

impl<'a, L> Unpin for Parser<'a, L>
where L: Unpin,

§

impl<'a, L> UnsafeUnpin for Parser<'a, L>

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.