Derive Default impls
This commit is contained in:
parent
54cc35677c
commit
c85d79dd9a
1 changed files with 4 additions and 14 deletions
|
@ -40,7 +40,7 @@ pub enum EntityType {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Data relating to a claim value.
|
/// Data relating to a claim value.
|
||||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
|
||||||
pub enum ClaimValueData {
|
pub enum ClaimValueData {
|
||||||
/// The ID of a file on Wikimedia Commons.
|
/// The ID of a file on Wikimedia Commons.
|
||||||
CommonsMedia(String),
|
CommonsMedia(String),
|
||||||
|
@ -120,35 +120,25 @@ pub enum ClaimValueData {
|
||||||
/// A sense ID on Wikidata.
|
/// A sense ID on Wikidata.
|
||||||
Sense(Sid),
|
Sense(Sid),
|
||||||
/// No value.
|
/// No value.
|
||||||
|
#[default]
|
||||||
NoValue,
|
NoValue,
|
||||||
/// Unknown value.
|
/// Unknown value.
|
||||||
UnknownValue,
|
UnknownValue,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ClaimValueData {
|
|
||||||
fn default() -> Self {
|
|
||||||
ClaimValueData::NoValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A statement rank.
|
/// A statement rank.
|
||||||
#[derive(Debug, Copy, Clone, Eq, PartialEq, PartialOrd, Ord, Serialize, Deserialize)]
|
#[derive(Debug, Copy, Clone, Eq, PartialEq, PartialOrd, Ord, Default, Serialize, Deserialize)]
|
||||||
pub enum Rank {
|
pub enum Rank {
|
||||||
/// The deprecated rank, indicating outdated/wrong info. Deprecated claims should usually be
|
/// The deprecated rank, indicating outdated/wrong info. Deprecated claims should usually be
|
||||||
/// ignored.
|
/// ignored.
|
||||||
Deprecated,
|
Deprecated,
|
||||||
/// Normal rank, the default.
|
/// Normal rank, the default.
|
||||||
|
#[default]
|
||||||
Normal,
|
Normal,
|
||||||
/// Preferred rank, indicates the claim is most recent or accurate.
|
/// Preferred rank, indicates the claim is most recent or accurate.
|
||||||
Preferred,
|
Preferred,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Rank {
|
|
||||||
fn default() -> Self {
|
|
||||||
Rank::Normal
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl FromStr for Rank {
|
impl FromStr for Rank {
|
||||||
type Err = EntityError;
|
type Err = EntityError;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue