Struct BufferedRecorder

Source
pub struct BufferedRecorder<E, R>
where E: Env, R: ReplayBufferBase,
{ /* private fields */ }
Expand description

A recorder that buffers sequences of observations and actions in memory.

The BufferedRecorder is designed to temporarily store sequences of environment interactions during evaluation runs. This is particularly useful for analyzing agent behavior, debugging policies, or collecting demonstration data.

§Type Parameters

  • E - The environment type that implements the Env trait
  • R - The replay buffer type that implements the ReplayBufferBase trait

Implementations§

Source§

impl<E, R> BufferedRecorder<E, R>
where E: Env, R: ReplayBufferBase,

Source

pub fn new() -> Self

Creates a new empty buffered recorder.

§Returns

A new instance of BufferedRecorder with an empty buffer.

Source

pub fn iter(&self) -> Iter<'_, Record>

Returns an iterator over the recorded data.

This method allows you to iterate over all records stored in the buffer without consuming them.

§Returns

An iterator over references to the Records in the buffer.

Trait Implementations§

Source§

impl<E, R> Default for BufferedRecorder<E, R>

Source§

fn default() -> BufferedRecorder<E, R>

Returns the “default value” for a type. Read more
Source§

impl<E, R> Recorder<E, R> for BufferedRecorder<E, R>
where E: Env, R: ReplayBufferBase,

Source§

fn write(&mut self, record: Record)

Writes a Record to the internal buffer.

This method appends the given record to the end of the buffer. The records maintain their insertion order, which is important for sequential data analysis.

§Arguments
  • record - The record to be stored in the buffer
§Note

This method is currently private as part of the Recorder trait implementation. Future versions may make it public if there’s a need for direct record insertion.

Source§

fn flush(&mut self, _step: i64)

Flushes the buffered data at the specified step.

This method is currently unimplemented as the buffered recorder is designed to hold all data in memory until explicitly processed.

§Arguments
  • _step - The step at which to flush the buffer
§Panics

This method will panic if called, as it is not implemented.

Source§

fn store(&mut self, _record: Record)

Stores a record in the underlying storage system.

This method is currently unimplemented as the buffered recorder only supports in-memory storage.

§Arguments
  • _record - The record to be stored
§Panics

This method will panic if called, as it is not implemented.

Source§

fn save_model(&self, base: &Path, agent: &Box<dyn Agent<E, R>>) -> Result<()>

Saves the current state of the agent’s model. Read more
Source§

fn load_model( &self, base: &Path, agent: &mut Box<dyn Agent<E, R>>, ) -> Result<()>

Loads a previously saved model state into the agent. Read more

Auto Trait Implementations§

§

impl<E, R> Freeze for BufferedRecorder<E, R>

§

impl<E, R> RefUnwindSafe for BufferedRecorder<E, R>

§

impl<E, R> Send for BufferedRecorder<E, R>
where E: Send, R: Send,

§

impl<E, R> Sync for BufferedRecorder<E, R>
where E: Sync, R: Sync,

§

impl<E, R> Unpin for BufferedRecorder<E, R>
where E: Unpin, R: Unpin,

§

impl<E, R> UnwindSafe for BufferedRecorder<E, R>
where E: UnwindSafe, R: UnwindSafe,

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V