pub struct XtcEncoder;Expand description
Minimal XTC-like lossy compression for particle positions.
Positions are quantised to integer multiples of 1e-3 nm (the default
XTC precision) and stored as big-endian i32 values, preceded by a 4-byte
particle count.
Implementations§
Source§impl XtcEncoder
impl XtcEncoder
Sourcepub fn compress_frame(positions: &[[f32; 3]]) -> Vec<u8> ⓘ
pub fn compress_frame(positions: &[[f32; 3]]) -> Vec<u8> ⓘ
Compress positions into a byte buffer using integer quantisation.
The precision is fixed at 1000 (i.e. 3 decimal places in nm units).
Sourcepub fn decompress_frame(buf: &[u8], n: usize) -> Option<Vec<[f32; 3]>>
pub fn decompress_frame(buf: &[u8], n: usize) -> Option<Vec<[f32; 3]>>
Decompress a byte buffer produced by compress_frame.
Returns None if buf is malformed.
Trait Implementations§
Source§impl Debug for XtcEncoder
impl Debug for XtcEncoder
Source§impl Default for XtcEncoder
impl Default for XtcEncoder
Source§fn default() -> XtcEncoder
fn default() -> XtcEncoder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for XtcEncoder
impl RefUnwindSafe for XtcEncoder
impl Send for XtcEncoder
impl Sync for XtcEncoder
impl Unpin for XtcEncoder
impl UnsafeUnpin for XtcEncoder
impl UnwindSafe for XtcEncoder
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.