Move WikiId to ids.rs
This doesn't change the exported items since both modules get reexported
This commit is contained in:
parent
ad918f8597
commit
30cd0db436
2 changed files with 13 additions and 13 deletions
|
@ -1,6 +1,6 @@
|
||||||
use std::{collections::BTreeMap, str::FromStr};
|
use std::{collections::BTreeMap, str::FromStr};
|
||||||
|
|
||||||
use crate::ids::{consts, Fid, IdParseError, Lid, Pid, Qid, Sid};
|
use crate::ids::{consts, Fid, IdParseError, Lid, Pid, Qid, Sid, WikiId};
|
||||||
use crate::text::{Lang, Text};
|
use crate::text::{Lang, Text};
|
||||||
use chrono::{DateTime, TimeZone, Utc};
|
use chrono::{DateTime, TimeZone, Utc};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -23,17 +23,6 @@ pub struct Entity {
|
||||||
pub aliases: BTreeMap<Lang, Vec<String>>,
|
pub aliases: BTreeMap<Lang, Vec<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Three main types of IDs entities can have.
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
||||||
pub enum WikiId {
|
|
||||||
/// A Qid, representing an entity.
|
|
||||||
EntityId(Qid),
|
|
||||||
/// A Pid, representing a property.
|
|
||||||
PropertyId(Pid),
|
|
||||||
/// An Lid, representing a lexeme.
|
|
||||||
LexemeId(Lid),
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The type of entity: normal entity with a Qid, a property with a Pid, or a lexeme with a Lid.
|
/// The type of entity: normal entity with a Qid, a property with a Pid, or a lexeme with a Lid.
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
|
|
11
src/ids.rs
11
src/ids.rs
|
@ -5,6 +5,17 @@ use std::{fmt, num::ParseIntError, str::FromStr};
|
||||||
|
|
||||||
pub mod consts;
|
pub mod consts;
|
||||||
|
|
||||||
|
/// Three main types of IDs entities can have.
|
||||||
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
|
pub enum WikiId {
|
||||||
|
/// A Qid, representing an entity.
|
||||||
|
EntityId(Qid),
|
||||||
|
/// A Pid, representing a property.
|
||||||
|
PropertyId(Pid),
|
||||||
|
/// An Lid, representing a lexeme.
|
||||||
|
LexemeId(Lid),
|
||||||
|
}
|
||||||
|
|
||||||
/// An error parsing an ID.
|
/// An error parsing an ID.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum IdParseError {
|
pub enum IdParseError {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue