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

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Executes the destructor for this type. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.