#[non_exhaustive]pub enum DoorState {
Closed,
Opening {
ticks_remaining: u32,
open_duration: u32,
close_duration: u32,
},
Open {
ticks_remaining: u32,
close_duration: u32,
},
Closing {
ticks_remaining: u32,
},
}Expand description
State machine for elevator doors.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Closed
Doors are fully closed.
Opening
Doors are in the process of opening.
Fields
Open
Doors are fully open and holding.
Fields
Closing
Doors are in the process of closing.
Implementations§
Source§impl DoorState
impl DoorState
Sourcepub const fn request_open(transition_ticks: u32, open_ticks: u32) -> Self
pub const fn request_open(transition_ticks: u32, open_ticks: u32) -> Self
Begin opening the door.
Sourcepub const fn tick(&mut self) -> DoorTransition
pub const fn tick(&mut self) -> DoorTransition
Advance the door state by one tick. Returns the transition that occurred.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DoorState
impl<'de> Deserialize<'de> for DoorState
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for DoorState
impl Eq for DoorState
impl StructuralPartialEq for DoorState
Auto Trait Implementations§
impl Freeze for DoorState
impl RefUnwindSafe for DoorState
impl Send for DoorState
impl Sync for DoorState
impl Unpin for DoorState
impl UnsafeUnpin for DoorState
impl UnwindSafe for DoorState
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