Skip to main content

RecPlayer

Struct RecPlayer 

Source
pub struct RecPlayer { /* private fields */ }
Expand description

Incremental player. Owns a private copy of the recording bytes and drives replay one step at a time. (b2RecPlayer)

Implementations§

Source§

impl RecPlayer

Source

pub fn create(data: &[u8]) -> Option<RecPlayer>

Open a recording for incremental playback. The player copies the bytes, so the source buffer can be dropped immediately after this call. Returns None if the recording is malformed. (b2RecPlayer_Create; workerCount is not a parameter of the serial port.)

Source

pub fn step_frame(&mut self) -> bool

Advance the replay by one recorded step. Returns true if a step executed, false once the end of the recording is reached. (b2RecPlayer_StepFrame)

Source

pub fn restart(&mut self)

Rewind the player to the first step, recreating the replay world from the frame-0 image in place. (b2RecPlayer_Restart)

Source

pub fn seek_frame(&mut self, target_frame: i32)

Seek to a recorded step. Seeking backward restores the nearest keyframe and re-runs the gap. Clamps to the recording bounds. (b2RecPlayer_SeekFrame)

Source

pub fn world(&self) -> &World

The replay world. (b2RecPlayer_GetWorldId)

Source

pub fn world_mut(&mut self) -> &mut World

Mutable access to the replay world, e.g. for a viewer’s world_draw.

Source

pub fn frame(&self) -> i32

The number of steps replayed so far. (b2RecPlayer_GetFrame)

Source

pub fn info(&self) -> RecPlayerInfo

Static metadata for the recording. (b2RecPlayer_GetInfo)

Source

pub fn is_at_end(&self) -> bool

True once the end of the recording has been reached. (b2RecPlayer_IsAtEnd)

Source

pub fn has_diverged(&self) -> bool

True if a recorded state hash or query failed to reproduce. (b2RecPlayer_HasDiverged)

Source

pub fn diverge_frame(&self) -> i32

The first step at which replay diverged, or -1. (b2RecPlayer_GetDivergeFrame)

Source

pub fn set_keyframe_policy( &mut self, budget_bytes: usize, min_interval_frames: i32, )

Tune the keyframe ring. A zero budget or a non-positive interval keeps that value. Clears the existing ring, so call restart afterward to repopulate it under the new policy. (b2RecPlayer_SetKeyframePolicy)

Source

pub fn keyframe_budget(&self) -> usize

(b2RecPlayer_GetKeyframeBudget)

Source

pub fn keyframe_min_interval(&self) -> i32

(b2RecPlayer_GetKeyframeMinInterval)

Source

pub fn keyframe_interval(&self) -> i32

The current keyframe spacing in frames; reflects the effective backward-seek granularity right now. (b2RecPlayer_GetKeyframeInterval)

Source

pub fn keyframe_bytes(&self) -> usize

The memory currently held by keyframe snapshots, in bytes. (b2RecPlayer_GetKeyframeBytes)

Source

pub fn draw_frame_queries(&self, draw: &mut dyn DebugDraw, query_index: i32)

Draw spatial queries recorded during the most recently replayed frame. Call after world_draw so queries are layered on top of the world. query_index < 0 draws all of them. (b2RecPlayer_DrawFrameQueries)

Source

pub fn frame_query_count(&self) -> i32

The number of spatial queries recorded for the most recently replayed frame. (b2RecPlayer_GetFrameQueryCount)

Source

pub fn frame_query(&self, index: i32) -> RecQueryInfo

A recorded query from the most recently replayed frame by index. (b2RecPlayer_GetFrameQuery)

Source

pub fn frame_query_hit(&self, query_index: i32, hit_index: i32) -> RecQueryHit

One result of a recorded query from the most recently replayed frame. (b2RecPlayer_GetFrameQueryHit)

Source

pub fn body_count(&self) -> i32

The number of body slots tracked for the outliner. This is the creation-order span and includes holes for destroyed bodies, so it only grows as the replay advances. (b2RecPlayer_GetBodyCount)

Source

pub fn body_id(&self, index: i32) -> BodyId

A tracked body by creation ordinal. Returns the null id for a destroyed slot or an out-of-range index; validate with body_is_valid. (b2RecPlayer_GetBodyId)

Source

pub fn is_ok(&self) -> bool

Internal-parity check used by validate tests: framing and ids read cleanly so far.

Trait Implementations§

Source§

impl Drop for RecPlayer

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.