Skip to main content

FlatObs

Trait FlatObs 

Source
pub trait FlatObs {
    // Required methods
    fn shape(&self) -> Vec<usize>;
    fn write_f32(&self, out: &mut [f32]);
}
Expand description

A native observation that can be copied into a flat f32 buffer, for VecEnv::step_into (which the NumPy arrays of the Python package use).

Required Methods§

Source

fn shape(&self) -> Vec<usize>

The shape of the observation.

Source

fn write_f32(&self, out: &mut [f32])

Writes the elements, converted to f32, in row-major order.

§Panics

Panics if out does not have one element per element of the observation.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: Element> FlatObs for Array<Native, T>

Source§

fn shape(&self) -> Vec<usize>

Source§

fn write_f32(&self, out: &mut [f32])

Source§

impl<T: Element> FlatObs for Scalar<Native, T>

Source§

fn shape(&self) -> Vec<usize>

Source§

fn write_f32(&self, out: &mut [f32])

Implementors§