Skip to main content

FakeHal

Struct FakeHal 

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

An in-memory fake Hal for tests and simulators.

Echoes writes back as state, and fakes joint actuation by mirroring any *.target_position write to the corresponding *.position (so a consumer that writes a target sees the measured position follow). Cheaply cloneable; clones share the same state. (Backed by State, the trivial owned state type.)

Implementations§

Source§

impl FakeHal

Source

pub fn new() -> Self

Source

pub fn with_description(description: HalDescription) -> Self

Source

pub fn set_model_glb(&self, glb: Vec<u8>)

Trait Implementations§

Source§

impl Clone for FakeHal

Source§

fn clone(&self) -> FakeHal

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for FakeHal

Source§

fn default() -> FakeHal

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

impl Hal for FakeHal

Source§

fn try_send(&self, changes: &StateChange)

Synchronous, immediate apply — the fake never blocks, so it needs no task of its own (unlike a real HTTP/DDS HAL).

Source§

fn describe<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = HalDescription> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Describe the device (model family, versions).
Source§

fn read<'life0, 'life1, 'async_trait>( &'life0 self, keys: &'life1 [Key], ) -> Pin<Box<dyn Future<Output = HalResult<Vec<Option<Value>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read the current values for the given keys. Each entry is None if the key is unset/absent (further nesting lives inside Value).
Source§

fn read_all<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = HalResult<State>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Read everything the HAL currently exposes.
Source§

fn write<'life0, 'async_trait>( &'life0 self, changes: StateChange, ) -> Pin<Box<dyn Future<Output = HalResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Apply actuator/state changes. Observers of updates see the resulting changes.
Source§

fn updates(&self) -> UpdatesStream

A feed of changes the hardware reports (sensors, mirrored actuation, …). Each call yields an independent, owned stream; the consumer that takes it is its one poller (natively the runtime’s run select, on the web the per-frame sweep).
Source§

impl HalAssets for FakeHal

Source§

fn model_glb<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = HalResult<Option<Vec<u8>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.