pub struct GetterStateDeviceWrapper<'a, T: Getter<State, E>, E: Copy + Debug> { /* private fields */ }Expand description
Connect a Getter<State, E> to a Terminal<E> for use as an encoder in the device system.
Implementations§
Source§impl<'a, T: Getter<State, E>, E: Copy + Debug> GetterStateDeviceWrapper<'a, T, E>
impl<'a, T: Getter<State, E>, E: Copy + Debug> GetterStateDeviceWrapper<'a, T, E>
Sourcepub const fn new(inner: T) -> Self
pub const fn new(inner: T) -> Self
Constructor for GetterStateDeviceWrapper.
Examples found in repository?
examples/devices.rs (line 77)
67fn main() {
68 println!("Commanding Motor to {:?}", COMMAND);
69 println!(
70 "K values are {:?}",
71 K_VALUES.get_k_values(PositionDerivative::from(COMMAND))
72 );
73 let motor = Motor::new();
74 let mut motor_wrapper =
75 devices::wrappers::PIDWrapper::new(motor, Time(0), STATE, COMMAND, K_VALUES);
76 let encoder = Encoder::default();
77 let mut encoder_wrapper = devices::wrappers::GetterStateDeviceWrapper::new(encoder);
78 connect(motor_wrapper.get_terminal(), encoder_wrapper.get_terminal());
79 for _ in 0..5 {
80 motor_wrapper.update().unwrap();
81 encoder_wrapper.update().unwrap();
82 }
83}Sourcepub fn get_terminal(&self) -> &'a RefCell<Terminal<'a, E>>
pub fn get_terminal(&self) -> &'a RefCell<Terminal<'a, E>>
Get a reference to this wrapper’s terminal.
Examples found in repository?
examples/devices.rs (line 78)
67fn main() {
68 println!("Commanding Motor to {:?}", COMMAND);
69 println!(
70 "K values are {:?}",
71 K_VALUES.get_k_values(PositionDerivative::from(COMMAND))
72 );
73 let motor = Motor::new();
74 let mut motor_wrapper =
75 devices::wrappers::PIDWrapper::new(motor, Time(0), STATE, COMMAND, K_VALUES);
76 let encoder = Encoder::default();
77 let mut encoder_wrapper = devices::wrappers::GetterStateDeviceWrapper::new(encoder);
78 connect(motor_wrapper.get_terminal(), encoder_wrapper.get_terminal());
79 for _ in 0..5 {
80 motor_wrapper.update().unwrap();
81 encoder_wrapper.update().unwrap();
82 }
83}Trait Implementations§
Source§impl<T: Getter<State, E>, E: Copy + Debug> Device<E> for GetterStateDeviceWrapper<'_, T, E>
impl<T: Getter<State, E>, E: Copy + Debug> Device<E> for GetterStateDeviceWrapper<'_, T, E>
Source§fn update_terminals(&mut self) -> NothingOrError<E>
fn update_terminals(&mut self) -> NothingOrError<E>
Call only the
update methods of owned terminals and do not update anything else with the
device.Auto Trait Implementations§
impl<'a, T, E> !Freeze for GetterStateDeviceWrapper<'a, T, E>
impl<'a, T, E> !RefUnwindSafe for GetterStateDeviceWrapper<'a, T, E>
impl<'a, T, E> !Send for GetterStateDeviceWrapper<'a, T, E>
impl<'a, T, E> !Sync for GetterStateDeviceWrapper<'a, T, E>
impl<'a, T, E> Unpin for GetterStateDeviceWrapper<'a, T, E>where
T: Unpin,
impl<'a, T, E> UnsafeUnpin for GetterStateDeviceWrapper<'a, T, E>where
T: UnsafeUnpin,
impl<'a, T, E> !UnwindSafe for GetterStateDeviceWrapper<'a, T, E>
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