Skip to main content

Recording

Struct Recording 

Source
pub struct Recording {
    pub buffer: Vec<u8>,
    pub accumulated_bounds: Aabb,
    pub have_bounds: bool,
    /* private fields */
}
Expand description

User-owned recording buffer. The world appends into it while recording; the user saves and destroys it. (b2Recording — the mutex is dropped in the serial port)

Fields§

§buffer: Vec<u8>§accumulated_bounds: Aabb

Union of world bounds over every recorded step, written out at stop so a replay can frame the whole motion. have_bounds gates the first union the same way world_get_bounds does.

§have_bounds: bool

Implementations§

Source§

impl Recording

Source

pub fn new(capacity_hint: usize) -> Recording

(b2CreateRecording — the capacity hint sizes the buffer up front)

Source

pub fn begin_record(&mut self, opcode: u8)

Start a framed record: opcode byte plus a 3-byte payload-size slot backpatched by Recording::end_record. (b2RecBeginRecord)

Source

pub fn end_record(&mut self)

Compute the final payload size and record it in the 24-bit space reserved right after the opcode. (b2RecEndRecord)

Source

pub fn commit_record(&mut self, opcode: u8, payload: &[u8])

Append a completed record (opcode + u24 size + payload) in one shot. (b2RecCommitRecord — lock-free in the serial port)

Source

pub fn accumulate_bounds(&mut self, bounds: Aabb)

Fold one step’s world bounds into the running union the recorder writes out at stop. (b2RecAccumulateBounds)

Trait Implementations§

Source§

impl Debug for Recording

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Recording

Source§

fn default() -> Recording

Returns the “default value” for a type. 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.