pub struct CoordinateBlock { /* private fields */ }Expand description
The positions of one frame.
§Examples
use molframe_core::CoordinateBlock;
let mut block = CoordinateBlock::with_capacity(3);
block.push([1.0, 2.0, 3.0]);
block.push([4.0, 5.0, 6.0]);
assert_eq!(block.len(), 2);
assert_eq!(block.as_slice()[1], [4.0, 5.0, 6.0]);Implementations§
Source§impl CoordinateBlock
impl CoordinateBlock
Sourcepub fn with_capacity(positions: usize) -> Self
pub fn with_capacity(positions: usize) -> Self
Creates a block with room for positions without reallocating.
Sourcepub fn push(&mut self, position: [f32; 3])
pub fn push(&mut self, position: [f32; 3])
Appends a position.
Copy-on-write detachment is performed at most once for the append, and the visible length changes only after the target slot has been written.
Sourcepub fn as_slice(&self) -> &[[f32; 3]]
pub fn as_slice(&self) -> &[[f32; 3]]
All positions, contiguously.
This slice is the whole point of the layout: it is what an array interface receives without a copy.
Sourcepub fn range(&self, range: Range<u32>) -> Option<&[[f32; 3]]>
pub fn range(&self, range: Range<u32>) -> Option<&[[f32; 3]]>
The positions a chunk covers, or None if the range runs past the end.
Sourcepub fn allocated_bytes(&self) -> usize
pub fn allocated_bytes(&self) -> usize
Backing allocation bytes, including spare capacity and unused lane tails.
Trait Implementations§
Source§impl Clone for CoordinateBlock
impl Clone for CoordinateBlock
Source§impl Debug for CoordinateBlock
impl Debug for CoordinateBlock
Source§impl Default for CoordinateBlock
impl Default for CoordinateBlock
Source§impl FromIterator<[f32; 3]> for CoordinateBlock
impl FromIterator<[f32; 3]> for CoordinateBlock
Auto Trait Implementations§
impl Freeze for CoordinateBlock
impl RefUnwindSafe for CoordinateBlock
impl Send for CoordinateBlock
impl Sync for CoordinateBlock
impl Unpin for CoordinateBlock
impl UnsafeUnpin for CoordinateBlock
impl UnwindSafe for CoordinateBlock
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more