pub trait Output: Device {
// Required methods
fn get_state(&self) -> State;
fn set_state(&mut self, state: State) -> Result<State, Error>;
fn get_default(&self) -> State;
fn animate<S: Into<State>>(
&mut self,
state: S,
duration: u64,
transition: Easing,
)
where Self: Sized;
fn is_busy(&self) -> bool;
fn stop(&mut self);
// Provided methods
fn reset(&mut self) -> Result<State, Error> { ... }
fn scale_state(
&mut self,
previous: State,
target: State,
progress: f32,
) -> State { ... }
}Expand description
A trait for devices that can act on the world: the board “outputs” some state onto them.
This trait extends Device and is intended for actuators that requires the same capabilities
as devices, including debugging, cloning, and concurrency support.
Required Methods§
Sourcefn set_state(&mut self, state: State) -> Result<State, Error>
fn set_state(&mut self, state: State) -> Result<State, Error>
Internal only: you should use the specific device state modifier functions instead.
Sourcefn get_default(&self) -> State
fn get_default(&self) -> State
Returns the actuator default (or neutral) state.
Sourcefn animate<S: Into<State>>(
&mut self,
state: S,
duration: u64,
transition: Easing,
)where
Self: Sized,
fn animate<S: Into<State>>(
&mut self,
state: S,
duration: u64,
transition: Easing,
)where
Self: Sized,
Animates the output of the device. In other word: the state of the device will be animated from current step to targeted step through an interpolation of in-between states. The function will last for the required duration and the interpolation will follow an easing transition function.
§Arguments
state: the targeted step to meetduration: the duration (in ms) the animation is expected to lasttransition: a transitionEasingfunction to apply on the state.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".