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 write_frame(&mut self, frame: &ConFrame) -> Result<()>
pub fn write_frame(&mut self, frame: &ConFrame) -> Result<()>
Writes a single ConFrame to the output stream.
Auto Trait Implementations§
impl<W> Freeze for ConFrameWriter<W>where
W: Freeze,
impl<W> RefUnwindSafe for ConFrameWriter<W>where
W: RefUnwindSafe,
impl<W> Send for ConFrameWriter<W>where
W: Send,
impl<W> Sync for ConFrameWriter<W>where
W: Sync,
impl<W> Unpin for ConFrameWriter<W>where
W: Unpin,
impl<W> UnsafeUnpin for ConFrameWriter<W>where
W: UnsafeUnpin,
impl<W> UnwindSafe for ConFrameWriter<W>where
W: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more