Move WikiId to ids.rs

This doesn't change the exported items since both modules get reexported
This commit is contained in:
Smitty 2021-09-05 15:22:39 -04:00
parent ad918f8597
commit 30cd0db436
2 changed files with 13 additions and 13 deletions

View file

@ -1,6 +1,6 @@
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 chrono::{DateTime, TimeZone, Utc};
use serde::{Deserialize, Serialize};
@ -23,17 +23,6 @@ pub struct Entity {
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.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]

View file

@ -5,6 +5,17 @@ use std::{fmt, num::ParseIntError, str::FromStr};
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.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum IdParseError {