pub struct EventStreamBuilder { /* private fields */ }Expand description
Builds an EventStream one event at a time, dropping events outside the
sensor. The single construction path shared by readers and (future) transforms.
Implementations§
Source§impl EventStreamBuilder
impl EventStreamBuilder
pub fn new(width: usize, height: usize, timestamp_scale_ms: f64) -> Self
pub fn with_capacity( width: usize, height: usize, timestamp_scale_ms: f64, capacity: usize, ) -> Self
Sourcepub fn push(&mut self, x: u16, y: u16, timestamp: i64, polarity: bool) -> bool
pub fn push(&mut self, x: u16, y: u16, timestamp: i64, polarity: bool) -> bool
Appends an event, returning false if it lies outside the sensor and was
dropped. Callers that treat out-of-bounds events as errors inspect the result.
Sourcepub fn extend_from_stream(&mut self, stream: &EventStream)
pub fn extend_from_stream(&mut self, stream: &EventStream)
Appends every event of stream, dropping any that fall outside this builder’s sensor.
The bulk counterpart of push, for the callers that join streams rather than
generate them — concatenation, and the streaming writers that hand on a window at a time.
When every event fits (the case for anything produced by a reader or the simulator, which
cannot emit a coordinate its own sensor does not have) this is four extend_from_slice
calls instead of a bounds check and four pushes per event; the scan that establishes that is
two comparisons per event and vectorises.
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves room for additional more events across every column.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn build(self) -> EventStream
Trait Implementations§
Source§impl Clone for EventStreamBuilder
impl Clone for EventStreamBuilder
Source§fn clone(&self) -> EventStreamBuilder
fn clone(&self) -> EventStreamBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for EventStreamBuilder
impl RefUnwindSafe for EventStreamBuilder
impl Send for EventStreamBuilder
impl Sync for EventStreamBuilder
impl Unpin for EventStreamBuilder
impl UnsafeUnpin for EventStreamBuilder
impl UnwindSafe for EventStreamBuilder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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