Use is_valid for Id

This commit is contained in:
2026-08-18 17:31:19 +03:00
parent 3cd7c12baa
commit d3c28179b6
10 changed files with 36 additions and 32 deletions
+7 -2
View File
@@ -28,7 +28,6 @@ const FADE_PER_DAY: f32 = 0.95;
#[derive(Clone, PartialEq, Eq, Debug, Hash, Copy)]
pub(crate) struct Id(u32);
pub const INVALID_ID: Id = Id(0);
impl FromStr for Id {
type Err = ParseIntError;
@@ -69,6 +68,12 @@ impl ToSql for Id {
}
}
impl Id {
pub(crate) fn is_valid(self) -> bool {
self.0 != 0
}
}
#[derive(Clone, Debug)]
pub struct KanaSet {
name: String,
@@ -703,4 +708,4 @@ impl DeckSettings {
pub fn require_speech(&self) -> bool {
self.forward == "speech" || self.backward == "speech"
}
}
}