pub struct Frame { /* private fields */ }Expand description
A complete frame of laser points authored by the application.
This is the unit of submission for frame-mode output. Frames are immutable
once created and cheaply cloneable via Arc.
§Example
use laser_dac::presentation::Frame;
use laser_dac::LaserPoint;
let frame = Frame::new(vec![
LaserPoint::new(0.0, 0.0, 65535, 0, 0, 65535),
LaserPoint::new(1.0, 0.0, 0, 65535, 0, 65535),
]);
assert_eq!(frame.len(), 2);Implementations§
Source§impl Frame
impl Frame
Sourcepub fn new(points: Vec<LaserPoint>) -> Self
pub fn new(points: Vec<LaserPoint>) -> Self
Create a new frame from a vector of points.
Sourcepub fn points(&self) -> &[LaserPoint]
pub fn points(&self) -> &[LaserPoint]
Returns a reference to the frame’s points.
Sourcepub fn first_point(&self) -> Option<&LaserPoint>
pub fn first_point(&self) -> Option<&LaserPoint>
Returns the first point, or None if the frame is empty.
Sourcepub fn last_point(&self) -> Option<&LaserPoint>
pub fn last_point(&self) -> Option<&LaserPoint>
Returns the last point, or None if the frame is empty.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnsafeUnpin for Frame
impl UnwindSafe for Frame
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