pub fn jump_sample_to(&mut self, timestamp: SystemTime) -> Option<ModelType> {
        let mut sample_package = self.store.get_adjacent_sample_at_timestamp(
            timestamp,
            Direction::Forward,
            &self.logger,
        );

        // timestamp is in future, find the latest sample
        if sample_package.is_none() {
            sample_package = self.store.get_adjacent_sample_at_timestamp(
                timestamp,
                Direction::Reverse,
                &self.logger,
            );
        }

        let sample_package = sample_package?;
        let model = self.store.to_model(&sample_package);
        // We will always set direction to Forward after jump to ease of caching
        self.current_direction = Direction::Forward;
        self.cached_sample = Some(sample_package.newer_sample);
        self.target_timestamp = sample_package.timestamp;

        model
    }
/// jump to the sample at timestamp.
// We will always use forward jump to make sure we can get two samples before(at)
// and after the timestamp. One exception here is the timestamp is in future, so
// if we get None, we will try search backward
jump to the sample at timestamp.
We will always use forward jump to make sure we can get two samples before(at)
and after the timestamp. One exception here is the timestamp is in future, so
if we get None, we will try search backward
jump to the sample at timestamp . We will always use forward jump to make sure we can get two samples before ( at ) and after the timestamp . One exception here is the timestamp is in future so if we get None we will try search backward
pub fn jump_sample_to(&mut self, timestamp: SystemTime) -> Option<ModelType> {
        let mut sample_package = self.store.get_adjacent_sample_at_timestamp(
            timestamp,
            Direction::Forward,
            &self.logger,
        );
        // timestamp is in future, find the latest sample
        if sample_package.is_none() {
            sample_package = self.store.get_adjacent_sample_at_timestamp(
                timestamp,
                Direction::Reverse,
                &self.logger,
            );
        }
        let sample_package = sample_package?;
        let model = self.store.to_model(&sample_package);
        // We will always set direction to Forward after jump to ease of caching
        self.current_direction = Direction::Forward;
        self.cached_sample = Some(sample_package.newer_sample);
        self.target_timestamp = sample_package.timestamp;
        model
    }
pub fn jump_sample_to ( & mut self , timestamp : SystemTime ) -> Option < ModelType > { let mut sample_package = self . store . get_adjacent_sample_at_timestamp ( timestamp , Direction :: Forward , & self . logger , ) ; // timestamp is in future, find the latest sample if sample_package . is_none ( ) { sample_package = self . store . get_adjacent_sample_at_timestamp ( timestamp , Direction :: Reverse , & self . logger , ) ; } let sample_package = sample_package ? ; let model = self . store . to_model ( & sample_package ) ; // We will always set direction to Forward after jump to ease of caching self . current_direction = Direction :: Forward ; self . cached_sample = Some ( sample_package . newer_sample ) ; self . target_timestamp = sample_package . timestamp ; model }
jump to the sample at timestamp.
jump to the sample at timestamp .
&mut self
timestamp
SystemTime
&mut self
timestamp
SystemTime