struct SignalRMQ {
timestamps: Vec<u64>,
values: Vec<f64>,
block_size: usize,
sparse_table: Vec<Vec<MinMax>>,
}Fields§
§timestamps: Vec<u64>§values: Vec<f64>§block_size: usize§sparse_table: Vec<Vec<MinMax>>sparse_table[level][block_idx] contains min/max for 2^level blocks starting at block_idx
Level 0 contains individual block summaries.
Implementations§
Source§impl SignalRMQ
impl SignalRMQ
fn new(signal: impl IntoIterator<Item = (u64, f64)>, block_size: usize) -> Self
Sourcefn build_sparse_table(block_summaries: &[MinMax]) -> Vec<Vec<MinMax>>
fn build_sparse_table(block_summaries: &[MinMax]) -> Vec<Vec<MinMax>>
Builds a sparse table for O(1) range min/max queries over blocks.
table[k][i] stores min/max over up to 2^k consecutive blocks starting at block i.
Any range query can be answered by combining at most two overlapping entries.
fn query_time_range(&self, t_start: u64, t_end: u64) -> Option<MinMax>
fn query_index_range(&self, l: usize, r: usize) -> MinMax
fn query_blocks(&self, l_block: usize, r_block: usize) -> MinMax
fn time_range(&self) -> Option<(u64, u64)>
Sourcefn query_at_time(&self, time: u64) -> CacheQueryResult
fn query_at_time(&self, time: u64) -> CacheQueryResult
Query the signal value at a specific time.
Returns the value at or before the query time, along with the next transition time.
If the query time is before the first sample, current is None but next points
to the first sample.
Auto Trait Implementations§
impl Freeze for SignalRMQ
impl RefUnwindSafe for SignalRMQ
impl Send for SignalRMQ
impl Sync for SignalRMQ
impl Unpin for SignalRMQ
impl UnwindSafe for SignalRMQ
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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