pub struct Terminal<'a, E: Copy + Debug> { /* private fields */ }Expand description
A place where a device can connect to another.
Implementations§
Source§impl<E: Copy + Debug> Terminal<'_, E>
impl<E: Copy + Debug> Terminal<'_, E>
Sourcepub const fn new_raw() -> Self
pub const fn new_raw() -> Self
Direct constructor for a Terminal. You almost always actually want RefCell<Terminal>
however, in which case you should call new, which returns RefCell<Terminal>.
Sourcepub const fn new() -> RefCell<Self>
pub const fn new() -> RefCell<Self>
This constructs a RefCell<Terminal>. This is almost always what you want, and what is
needed for connecting terminals. If you do just want a Terminal, use
new_raw instead.
Sourcepub fn disconnect(&mut self)
pub fn disconnect(&mut self)
Disconnect this terminal and the one that it is connected to. You can connect terminals by
calling the rrtk::connect function.
Trait Implementations§
Source§impl<E: Copy + Debug> Getter<TerminalData, E> for Terminal<'_, E>
impl<E: Copy + Debug> Getter<TerminalData, E> for Terminal<'_, E>
Source§fn get(&self) -> Output<TerminalData, E>
fn get(&self) -> Output<TerminalData, E>
Get something.
Source§impl<E: Copy + Debug> Settable<Datum<Command>, E> for Terminal<'_, E>
impl<E: Copy + Debug> Settable<Datum<Command>, E> for Terminal<'_, E>
Source§fn get_settable_data_ref(&self) -> &SettableData<Datum<Command>, E>
fn get_settable_data_ref(&self) -> &SettableData<Datum<Command>, E>
As traits cannot have fields, get functions and separate types are required. All you have to
do is make a field for a corresponding
SettableData, make this return an immutable
reference to it, and make get_settable_data_mut
return a mutable reference to it.Source§fn get_settable_data_mut(&mut self) -> &mut SettableData<Datum<Command>, E>
fn get_settable_data_mut(&mut self) -> &mut SettableData<Datum<Command>, E>
As traits cannot have fields, get functions and separate types are required. All you have to
do is make a field for a corresponding
SettableData, make this return a mutable
reference to it, and make get_settable_data_ref
return an immutable reference to it.Source§fn impl_set(&mut self, _command: Datum<Command>) -> NothingOrError<E>
fn impl_set(&mut self, _command: Datum<Command>) -> NothingOrError<E>
Set something, not updating the internal
SettableData. Due to current limitations of the
language, you must implement this but call set. Do not call this directly as it will make
get_last_request work incorrectly.Source§fn set(&mut self, value: S) -> NothingOrError<E>
fn set(&mut self, value: S) -> NothingOrError<E>
Set something to a value. For example, this could set a motor to a voltage. You should call
this and not
impl_set.Source§fn follow(&mut self, getter: Reference<dyn Getter<S, E>>)
fn follow(&mut self, getter: Reference<dyn Getter<S, E>>)
Begin following a
Getter of the same type. For this to work, you must have
update_following_data in your Updatable implementation.Source§fn stop_following(&mut self)
fn stop_following(&mut self)
Stop following the
Getter.Source§fn update_following_data(&mut self) -> NothingOrError<E>
fn update_following_data(&mut self) -> NothingOrError<E>
Get a new value from the
Getter we’re following, if there is one, and call
set
accordingly. You must add this to your Updatable implementation if you are following
Getters. This is a current limitation of the Rust language. If specialization is ever
stabilized, this will hopefully be done in a better way.Source§fn get_last_request(&self) -> Option<S>
fn get_last_request(&self) -> Option<S>
Get the argument from the last time
set was called.Source§impl<E: Copy + Debug> Settable<Datum<State>, E> for Terminal<'_, E>
impl<E: Copy + Debug> Settable<Datum<State>, E> for Terminal<'_, E>
Source§fn get_settable_data_ref(&self) -> &SettableData<Datum<State>, E>
fn get_settable_data_ref(&self) -> &SettableData<Datum<State>, E>
As traits cannot have fields, get functions and separate types are required. All you have to
do is make a field for a corresponding
SettableData, make this return an immutable
reference to it, and make get_settable_data_mut
return a mutable reference to it.Source§fn get_settable_data_mut(&mut self) -> &mut SettableData<Datum<State>, E>
fn get_settable_data_mut(&mut self) -> &mut SettableData<Datum<State>, E>
As traits cannot have fields, get functions and separate types are required. All you have to
do is make a field for a corresponding
SettableData, make this return a mutable
reference to it, and make get_settable_data_ref
return an immutable reference to it.Source§fn impl_set(&mut self, _state: Datum<State>) -> NothingOrError<E>
fn impl_set(&mut self, _state: Datum<State>) -> NothingOrError<E>
Set something, not updating the internal
SettableData. Due to current limitations of the
language, you must implement this but call set. Do not call this directly as it will make
get_last_request work incorrectly.Source§fn set(&mut self, value: S) -> NothingOrError<E>
fn set(&mut self, value: S) -> NothingOrError<E>
Set something to a value. For example, this could set a motor to a voltage. You should call
this and not
impl_set.Source§fn follow(&mut self, getter: Reference<dyn Getter<S, E>>)
fn follow(&mut self, getter: Reference<dyn Getter<S, E>>)
Begin following a
Getter of the same type. For this to work, you must have
update_following_data in your Updatable implementation.Source§fn stop_following(&mut self)
fn stop_following(&mut self)
Stop following the
Getter.Source§fn update_following_data(&mut self) -> NothingOrError<E>
fn update_following_data(&mut self) -> NothingOrError<E>
Get a new value from the
Getter we’re following, if there is one, and call
set
accordingly. You must add this to your Updatable implementation if you are following
Getters. This is a current limitation of the Rust language. If specialization is ever
stabilized, this will hopefully be done in a better way.Source§fn get_last_request(&self) -> Option<S>
fn get_last_request(&self) -> Option<S>
Get the argument from the last time
set was called.Auto Trait Implementations§
impl<'a, E> Freeze for Terminal<'a, E>
impl<'a, E> !RefUnwindSafe for Terminal<'a, E>
impl<'a, E> !Send for Terminal<'a, E>
impl<'a, E> !Sync for Terminal<'a, E>
impl<'a, E> Unpin for Terminal<'a, E>
impl<'a, E> !UnwindSafe for Terminal<'a, 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