Peripherals

Struct Peripherals 

Source
pub struct Peripherals {
Show 30 fields pub screen: Screen, pub port_1: SmartPort, pub port_2: SmartPort, pub port_3: SmartPort, pub port_4: SmartPort, pub port_5: SmartPort, pub port_6: SmartPort, pub port_7: SmartPort, pub port_8: SmartPort, pub port_9: SmartPort, pub port_10: SmartPort, pub port_11: SmartPort, pub port_12: SmartPort, pub port_13: SmartPort, pub port_14: SmartPort, pub port_15: SmartPort, pub port_16: SmartPort, pub port_17: SmartPort, pub port_18: SmartPort, pub port_19: SmartPort, pub port_20: SmartPort, pub port_21: SmartPort, pub adi_a: AdiPort, pub adi_b: AdiPort, pub adi_c: AdiPort, pub adi_d: AdiPort, pub adi_e: AdiPort, pub adi_f: AdiPort, pub adi_g: AdiPort, pub adi_h: AdiPort,
}
Expand description

A struct that contains all ports on the V5 Brain and guarentees at compile time that each port is only used once. Because of the fact that this checks at compile time, it cannot be moved once it has been used to create a device. If you need to store a peripherals struct for use in multiple functions, use DynamicPeripherals instead. This struct is always preferred over DynamicPeripherals when possible.

Fields§

§screen: Screen

Brain screen

§port_1: SmartPort

Smart port 1 on the brain

§port_2: SmartPort

Smart port 2 on the brain

§port_3: SmartPort

Smart port 3 on the brain

§port_4: SmartPort

Smart port 4 on the brain

§port_5: SmartPort

Smart port 5 on the brain

§port_6: SmartPort

Smart port 6 on the brain

§port_7: SmartPort

Smart port 7 on the brain

§port_8: SmartPort

Smart port 8 on the brain

§port_9: SmartPort

Smart port 9 on the brain

§port_10: SmartPort

Smart port 10 on the brain

§port_11: SmartPort

Smart port 11 on the brain

§port_12: SmartPort

Smart port 12 on the brain

§port_13: SmartPort

Smart port 13 on the brain

§port_14: SmartPort

Smart port 14 on the brain

§port_15: SmartPort

Smart port 15 on the brain

§port_16: SmartPort

Smart port 16 on the brain

§port_17: SmartPort

Smart port 17 on the brain

§port_18: SmartPort

Smart port 18 on the brain

§port_19: SmartPort

Smart port 19 on the brain

§port_20: SmartPort

Smart port 20 on the brain

§port_21: SmartPort

Smart port 21 on the brain

§adi_a: AdiPort

Adi port A on the brain.

§adi_b: AdiPort

Adi port B on the brain.

§adi_c: AdiPort

Adi port C on the brain.

§adi_d: AdiPort

Adi port D on the brain.

§adi_e: AdiPort

Adi port E on the brain.

§adi_f: AdiPort

Adi port F on the brain.

§adi_g: AdiPort

Adi port G on the brain.

§adi_h: AdiPort

Adi port H on the brain.

Implementations§

Source§

impl Peripherals

Source

pub fn take() -> Option<Self>

Attempts to create a new Peripherals struct, returning None if one has already been created.

After calling this function, future calls to Peripherals::take will return None.

Source

pub unsafe fn steal() -> Self

Creates a new Peripherals struct without ensuring that is the only unique instance.

After calling this function, future calls to Peripherals::take will return None.

§Safety

Creating new SmartPorts and Peripherals instances is inherently unsafe due to the possibility of constructing more than one device on the same port index and allowing multiple mutable references to the same hardware device. The caller must ensure that only one mutable reference to each port is used.

Trait Implementations§

Source§

impl Debug for Peripherals

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Peripherals> for DynamicPeripherals

Source§

fn from(peripherals: Peripherals) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.