reduce feature
This commit is contained in:
@ -11,20 +11,20 @@ pub enum Action {
|
||||
None = 7,
|
||||
}
|
||||
|
||||
impl TryFrom<i32> for Action {
|
||||
type Error = &'static str;
|
||||
// impl TryFrom<i32> for Action {
|
||||
// type Error = &'static str;
|
||||
|
||||
fn try_from(value: i32) -> Result<Self, Self::Error> {
|
||||
match value {
|
||||
0 => Ok(Action::Forward),
|
||||
1 => Ok(Action::Backward),
|
||||
2 => Ok(Action::TurnRight),
|
||||
3 => Ok(Action::TurnLeft),
|
||||
4 => Ok(Action::AimRight),
|
||||
5 => Ok(Action::AimLeft),
|
||||
6 => Ok(Action::Shoot),
|
||||
7 => Ok(Action::None),
|
||||
_ => Err("Invalid action"),
|
||||
}
|
||||
}
|
||||
}
|
||||
// fn try_from(value: i32) -> Result<Self, Self::Error> {
|
||||
// match value {
|
||||
// 0 => Ok(Action::Forward),
|
||||
// 1 => Ok(Action::Backward),
|
||||
// 2 => Ok(Action::TurnRight),
|
||||
// 3 => Ok(Action::TurnLeft),
|
||||
// 4 => Ok(Action::AimRight),
|
||||
// 5 => Ok(Action::AimLeft),
|
||||
// 6 => Ok(Action::Shoot),
|
||||
// 7 => Ok(Action::None),
|
||||
// _ => Err("Invalid action"),
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
Reference in New Issue
Block a user