Animatrix: simulators, add features

This commit is contained in:
Luke D. Jones
2023-06-25 18:29:19 +12:00
parent 3d6d92ae7d
commit 8b77078a6f
8 changed files with 50 additions and 24 deletions

View File

@@ -1,4 +1,5 @@
use std::convert::TryFrom;
use std::str::FromStr;
use std::thread::sleep;
use std::time::{Duration, Instant};
@@ -53,6 +54,19 @@ pub enum AnimeType {
Unknown,
}
impl FromStr for AnimeType {
type Err = AnimeError;
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
Ok(match s {
"ga401" | "GA401" => Self::GA401,
"ga402" | "GA402" => Self::GA402,
"gu604" | "GU604" => Self::GU604,
_ => Self::Unknown,
})
}
}
impl AnimeType {
/// The width of diagonal images
pub fn width(&self) -> usize {