pub struct DynamicPeripherals { /* private fields */ }Expand description
Guarentees that ports are only used once at runtime
This is useful for when you want to store a peripherals struct for use in multiple functions.
When possible, use Peripherals instead.
Implementations§
Source§impl DynamicPeripherals
impl DynamicPeripherals
Sourcepub fn new(_peripherals: Peripherals) -> Self
pub fn new(_peripherals: Peripherals) -> Self
Creates a new dynamic peripherals
In order to guarentee that no ports created by this struct,
this function takes a Peripherals.
This guarentees safety because Peripherals cannot be passed by value
after they have been used to create devices.
Sourcepub fn take_smart_port(&mut self, port_index: u8) -> Option<SmartPort>
pub fn take_smart_port(&mut self, port_index: u8) -> Option<SmartPort>
Sourcepub fn take_adi_port(&mut self, port_index: u8) -> Option<AdiPort>
pub fn take_adi_port(&mut self, port_index: u8) -> Option<AdiPort>
Sourcepub fn take_screen(&mut self) -> Option<Screen>
pub fn take_screen(&mut self) -> Option<Screen>
Creates a Screen only if one has not been created before.
Trait Implementations§
Source§impl Debug for DynamicPeripherals
impl Debug for DynamicPeripherals
Source§impl From<Peripherals> for DynamicPeripherals
impl From<Peripherals> for DynamicPeripherals
Source§fn from(peripherals: Peripherals) -> Self
fn from(peripherals: Peripherals) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for DynamicPeripherals
impl RefUnwindSafe for DynamicPeripherals
impl Send for DynamicPeripherals
impl Sync for DynamicPeripherals
impl Unpin for DynamicPeripherals
impl UnwindSafe for DynamicPeripherals
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