pub struct BinaryTrajectoryWriter {
pub header: BinaryHeader,
/* private fields */
}Expand description
Streaming writer for the OxiPhysics binary trajectory format.
Call write_frame for each step,
then finalize to obtain the complete
byte buffer (header n_frames is patched at finalization).
Fields§
§header: BinaryHeaderEmbedded file header.
Implementations§
Source§impl BinaryTrajectoryWriter
impl BinaryTrajectoryWriter
Sourcepub fn new(n_particles: u64, dt: f64) -> Self
pub fn new(n_particles: u64, dt: f64) -> Self
Create a writer for the given number of particles and time step.
Sourcepub fn write_frame(&mut self, frame: &ParticleFrame)
pub fn write_frame(&mut self, frame: &ParticleFrame)
Append one frame to the internal buffer.
Sourcepub fn finalize(self) -> Vec<u8> ⓘ
pub fn finalize(self) -> Vec<u8> ⓘ
Finalise: patch n_frames in the header and return the buffer.
Sourcepub fn frame_count(&self) -> u64
pub fn frame_count(&self) -> u64
Number of frames written so far.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BinaryTrajectoryWriter
impl RefUnwindSafe for BinaryTrajectoryWriter
impl Send for BinaryTrajectoryWriter
impl Sync for BinaryTrajectoryWriter
impl Unpin for BinaryTrajectoryWriter
impl UnsafeUnpin for BinaryTrajectoryWriter
impl UnwindSafe for BinaryTrajectoryWriter
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
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.