Struct hepmc2::writer::Writer [−][src]
pub struct Writer<T: Write> { /* fields omitted */ }
Expand description
Writer for the HepMC2 format
Implementations
Retrieve the underlying writer
Construct new Writer
This automatically tries to write the mandatory HepMC header, which may fail.
Example
use hepmc2::writer::Writer;
let mut output = Vec::new();
let mut writer = Writer::new(&mut output)?;
// always call finish at the end
writer.finish()?;
Construct new Writer
, trying to write a custom header
hepmc2
ignores headers, but other implementations of the
format may be less lenient.
Example
use hepmc2::writer::Writer;
let mut output = Vec::new();
let mut writer = Writer::with_header(output, "")?;
// always call finish at the end
writer.finish()?;
Finish writing, consuming the Writer
This tries to write the mandatory HepMC footer, which may fail.
Example
use hepmc2::writer::Writer;
let mut output = Vec::new();
let mut writer = Writer::new(&mut output)?;
// always call finish at the end
writer.finish()?;
Write an event
Example
use hepmc2::writer::Writer;
use hepmc2::event::Event;
let mut output = Vec::new();
let mut writer = Writer::new(&mut output)?;
let event = Event::default();
writer.write(&event)?;
// always call finish at the end
writer.finish()?;
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more