pub struct Writer<'a, L> {
pub writer: DeferredWriter<'a>,
pub code: usize,
/* private fields */
}Fields§
§writer: DeferredWriter<'a>§code: usizeImplementations§
Source§impl<'a, L> Writer<'a, L>where
L: Lit,
impl<'a, L> Writer<'a, L>where
L: Lit,
Sourcepub fn new(writer: DeferredWriter<'a>) -> Self
pub fn new(writer: DeferredWriter<'a>) -> Self
Examples found in repository?
16fn main_err() -> Result<(), Error<u32>> {
17 let stdin = std::io::stdin();
18 let stdout = std::io::stdout();
19
20 let aag_reader = ascii::Parser::<u32>::from_read(stdin.lock(), ascii::Config::default())?;
21
22 let aag = aag_reader.parse()?;
23
24 let (aig, _) = Renumber::renumber_aig(
25 RenumberConfig::default()
26 .trim(true)
27 .structural_hash(true)
28 .const_fold(true),
29 &aag,
30 )?;
31
32 let aig_writer = DeferredWriter::from_write(stdout.lock());
33 let mut aag_writer = binary::Writer::<u32>::new(aig_writer);
34
35 aag_writer.write_ordered_aig(&aig);
36
37 aag_writer.flush()?;
38 Ok(())
39}pub fn write_header(&mut self, header: &Header)
pub fn write_lit(&mut self, lit: L)
pub fn write_latch(&mut self, latch: OrderedLatch<L>)
pub fn write_count(&mut self, count: usize)
pub fn write_and_gate(&mut self, and_gate: OrderedAndGate<L>)
pub fn write_symbol(&mut self, symbol: &Symbol<'_>)
pub fn write_comment(&mut self, comment: &str)
Sourcepub fn write_ordered_aig(&mut self, aig: &OrderedAig<L>)
pub fn write_ordered_aig(&mut self, aig: &OrderedAig<L>)
Examples found in repository?
16fn main_err() -> Result<(), Error<u32>> {
17 let stdin = std::io::stdin();
18 let stdout = std::io::stdout();
19
20 let aag_reader = ascii::Parser::<u32>::from_read(stdin.lock(), ascii::Config::default())?;
21
22 let aag = aag_reader.parse()?;
23
24 let (aig, _) = Renumber::renumber_aig(
25 RenumberConfig::default()
26 .trim(true)
27 .structural_hash(true)
28 .const_fold(true),
29 &aag,
30 )?;
31
32 let aig_writer = DeferredWriter::from_write(stdout.lock());
33 let mut aag_writer = binary::Writer::<u32>::new(aig_writer);
34
35 aag_writer.write_ordered_aig(&aig);
36
37 aag_writer.flush()?;
38 Ok(())
39}Methods from Deref<Target = DeferredWriter<'a>>§
Sourcepub fn flush_defer_err(&mut self)
pub fn flush_defer_err(&mut self)
Flush the buffered data to the underlying Write instance, deferring IO errors.
Sourcepub fn write_all_defer_err(&mut self, buf: &[u8])
pub fn write_all_defer_err(&mut self, buf: &[u8])
Sourcepub fn buf_write_ptr(&mut self, len: usize) -> *mut u8
pub fn buf_write_ptr(&mut self, len: usize) -> *mut u8
Returns a pointer to the current write pointer within the internal buffer if sufficient space is available.
If only fewer than len bytes are available, this returns a null pointer.
Can be used in conjunction with advance_unchecked to construct
output data directly within the output buffer, potentially avoiding a redundant copy.
Sourcepub unsafe fn advance_unchecked(&mut self, len: usize)
pub unsafe fn advance_unchecked(&mut self, len: usize)
Advances the write pointer within the internal buffer.
§Safety
This assumes that a) there is sufficient space left in the buffer and b) that the bytes the
pointer is advanced over were initialized prior to calling this (via
buf_write_ptr).
If either assumption does not hold calling this results in undefined behavior.
Sourcepub fn check_io_error(&mut self) -> Result<(), Error>
pub fn check_io_error(&mut self) -> Result<(), Error>
Returns an encountered IO errors as Err(io_err).
This resets the stored IO error and returns Ok(()) if no IO error is stored.