pub struct ConFrameWriter<W: Write> { /* private fields */ }Expand description
A writer that can serialize and write ConFrame objects to any output stream.
This struct encapsulates a writer (like a file) and provides a high-level API
for writing simulation frames in the .con format.
§Example
let mut writer = ConFrameWriter::from_path("output.con").unwrap();
writer.extend(frames.iter()).unwrap();Implementations§
Source§impl<W: Write> ConFrameWriter<W>
impl<W: Write> ConFrameWriter<W>
Sourcepub fn new(writer: W) -> Self
pub fn new(writer: W) -> Self
Creates a new ConFrameWriter that wraps a given writer.
§Arguments
writer- Any type that implementsstd::io::Write, e.g., aFile.
Sourcepub fn with_precision(writer: W, precision: usize) -> Self
pub fn with_precision(writer: W, precision: usize) -> Self
Creates a new ConFrameWriter with a custom floating-point precision.
§Arguments
writer- Any type that implementsstd::io::Write.precision- Number of decimal places for floating-point output.
Sourcepub fn with_float_format(writer: W, float_format: FloatFormat) -> Self
pub fn with_float_format(writer: W, float_format: FloatFormat) -> Self
Creates a writer with an explicit numeric text representation.
FloatFormat::RoundTrip retains small forces and coordinates exactly.
Metadata floats use the JSON serializer independently of this setting.
Sourcepub fn canonical(self, on: bool) -> Self
pub fn canonical(self, on: bool) -> Self
Opt-in canonical serialization: BTree-ordered metadata keys in JSON,
fixed section order, stable float precision (default 6). Use for corpus
materialization and content-stable hashes; not required for on-disk fidelity
of spans preserved from next_with_raw_span.
Sourcepub fn set_canonical(&mut self, on: bool)
pub fn set_canonical(&mut self, on: bool)
Set or clear canonical mode on an existing writer (C ABI / FFI).
Sourcepub fn is_canonical(&self) -> bool
pub fn is_canonical(&self) -> bool
Whether canonical serialization is enabled.
Sourcepub fn write_frame(&mut self, frame: &ConFrame) -> Result<()>
pub fn write_frame(&mut self, frame: &ConFrame) -> Result<()>
Writes a single ConFrame to the output stream.