pub struct FrameRateDecorator<'a, C> { /* private fields */ }
Expand description

A struct which decorates a Collector implementation with a target frame duration, in order to control the frame rate of the replay processing. If a frame is processed and the next desired frame time is before the target_frame_duration, TimeAdvance::Time is used to ensure the next frame will only be processed after the target_frame_duration has passed.

Implementations§

source§

impl<'a, C> FrameRateDecorator<'a, C>

source

pub fn new(target_frame_duration: f32, collector: &'a mut C) -> Self

Constructs a new FrameRateDecorator instance with a given target frame duration and underlying Collector reference.

Arguments
  • target_frame_duration: The target duration for each frame in seconds.
  • collector: A mutable reference to the underlying Collector instance.
source

pub fn new_from_fps(fps: f32, collector: &'a mut C) -> Self

Constructs a new FrameRateDecorator instance with a desired frames per second (fps) rate and underlying Collector reference. The target frame duration is computed as the reciprocal of the fps value.

Arguments
  • fps: The desired frame rate in frames per second.
  • collector: A mutable reference to the underlying Collector instance.

Trait Implementations§

source§

impl<'a, C: Collector> Collector for FrameRateDecorator<'a, C>

source§

fn process_frame( &mut self, processor: &ReplayProcessor<'_>, frame: &Frame, frame_number: usize, current_time: f32 ) -> SubtrActorResult<TimeAdvance>

Processes the given frame, delegating to the underlying Collector’s process_frame method, then adjusts the returned TimeAdvance based on the target frame duration.

If the original TimeAdvance was TimeAdvance::NextFrame or a TimeAdvance::Time less than the target frame duration, this method returns a TimeAdvance::Time equal to the current time plus the target frame duration.

If the original TimeAdvance was a TimeAdvance::Time greater than the target frame duration, this method returns the original TimeAdvance::Time.

source§

fn process_replay(self, replay: &Replay) -> SubtrActorResult<Self>

Process an entire replay. Read more

Auto Trait Implementations§

§

impl<'a, C> RefUnwindSafe for FrameRateDecorator<'a, C>where C: RefUnwindSafe,

§

impl<'a, C> Send for FrameRateDecorator<'a, C>where C: Send,

§

impl<'a, C> Sync for FrameRateDecorator<'a, C>where C: Sync,

§

impl<'a, C> Unpin for FrameRateDecorator<'a, C>

§

impl<'a, C> !UnwindSafe for FrameRateDecorator<'a, C>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.