Use is_valid for Id
This commit is contained in:
+7
-2
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user