#[repr(u8)]pub enum RobotName {
Pierre = 0,
Prince = 1,
Patric = 2,
Stella = 3,
Stevie = 4,
Speers = 5,
}
Expand description
Represents a unique robot, either a physical device or a simulation
Robot names are six letters, where the first letter indicates its type:
- names beginning with ‘S’ are simulated robots, not real
- names beginning with ‘P’ are raspberry pi pico boards
See NUM_ROBOT_NAMES
for the number of names
usize values should be consecutive such that an array like [(); NUM_ROBOT_NAMES]
can be indexed like arr[robot_name as usize]
However, while they are set at compile time, these values are not stable over the
development of the codebase; code should not, for example, specifically rely on
Stella
as index 0
Variants§
Implementations§
source§impl RobotName
impl RobotName
pub fn get_str(&self) -> &'static str
sourcepub fn is_simulated(&self) -> bool
pub fn is_simulated(&self) -> bool
Whether this robot is managed by the simulator
sourcepub fn mac_address(&self) -> [u8; 6]
pub fn mac_address(&self) -> [u8; 6]
The mac address of this robot, must be unique
Simulated robots look like 02:00:00:00::00:xx
sourcepub fn from_mac_address(address: &[u8; 6]) -> Option<Self>
pub fn from_mac_address(address: &[u8; 6]) -> Option<Self>
Uniquely determine the robot name from the mac address, if recognized
Simulated robots look like 02:00:00:00::00:xx
sourcepub fn default_ip(&self) -> [u8; 4]
pub fn default_ip(&self) -> [u8; 4]
The default pre-filled ip - robots need not necessarily use this ip
sourcepub fn port(&self) -> u16
pub fn port(&self) -> u16
The port this robot will listen on for TCP connections
Physical robots may listen on the same port
sourcepub fn robot(&self) -> RobotDefinition<3>
pub fn robot(&self) -> RobotDefinition<3>
The characteristics of this robot
Trait Implementations§
source§impl<'de> Deserialize<'de> for RobotName
impl<'de> Deserialize<'de> for RobotName
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Ord for RobotName
impl Ord for RobotName
source§impl PartialOrd for RobotName
impl PartialOrd for RobotName
impl Copy for RobotName
impl Eq for RobotName
impl StructuralPartialEq for RobotName
Auto Trait Implementations§
impl Freeze for RobotName
impl RefUnwindSafe for RobotName
impl Send for RobotName
impl Sync for RobotName
impl Unpin for RobotName
impl UnwindSafe for RobotName
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
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.