pub struct NullVehicle { /* private fields */ }Expand description
A vehicle that reports a fixed state, ignores commands, and counts both.
§Examples
use std::time::Duration;
use stable_flight::testing::NullVehicle;
use stable_flight::{Actuator, ActuatorCommand, StateSource};
let mut vehicle = NullVehicle::default();
vehicle.state(Duration::ZERO);
vehicle.actuate(&ActuatorCommand::default());
assert_eq!((vehicle.state_reads(), vehicle.actuations()), (1, 1));Implementations§
Source§impl NullVehicle
impl NullVehicle
Sourcepub fn with_state(state: VehicleState) -> Self
pub fn with_state(state: VehicleState) -> Self
A vehicle that always reports state.
Sourcepub fn state_reads(&self) -> u64
pub fn state_reads(&self) -> u64
How many times state was called (including priming).
Sourcepub fn actuations(&self) -> u64
pub fn actuations(&self) -> u64
How many times actuate was called.
Sourcepub fn last_actuation(&self) -> Option<&ActuatorCommand>
pub fn last_actuation(&self) -> Option<&ActuatorCommand>
The most recent actuator command, if any.
Trait Implementations§
Source§impl Actuator for NullVehicle
impl Actuator for NullVehicle
Source§fn actuate(&mut self, actuator_command: &ActuatorCommand)
fn actuate(&mut self, actuator_command: &ActuatorCommand)
Actuates the vehicle’s control surfaces and/or motors based on the command. Read more
Source§impl Clone for NullVehicle
impl Clone for NullVehicle
Source§impl Debug for NullVehicle
impl Debug for NullVehicle
Source§impl Default for NullVehicle
impl Default for NullVehicle
Source§impl StateSource for NullVehicle
impl StateSource for NullVehicle
Auto Trait Implementations§
impl Freeze for NullVehicle
impl RefUnwindSafe for NullVehicle
impl Send for NullVehicle
impl Sync for NullVehicle
impl Unpin for NullVehicle
impl UnsafeUnpin for NullVehicle
impl UnwindSafe for NullVehicle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.