From 30cd0db4363c494b103a3284d618bd27c3a15cdc Mon Sep 17 00:00:00 2001 From: Smitty Date: Sun, 5 Sep 2021 15:22:39 -0400 Subject: [PATCH] Move WikiId to ids.rs This doesn't change the exported items since both modules get reexported --- src/entity.rs | 15 ++------------- src/ids.rs | 11 +++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/entity.rs b/src/entity.rs index dd36c39..4aaaf1e 100755 --- a/src/entity.rs +++ b/src/entity.rs @@ -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}; @@ -9,7 +9,7 @@ use serde_json::Value; /// A Wikibase entity: this could be an entity, property, or lexeme. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Entity { - ///Unique identifier + /// Unique identifier pub id: WikiId, /// All of the claims on the entity. pub claims: Vec<(Pid, ClaimValue)>, @@ -23,17 +23,6 @@ pub struct Entity { pub aliases: BTreeMap>, } -/// 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] diff --git a/src/ids.rs b/src/ids.rs index e8dfcb2..b172633 100755 --- a/src/ids.rs +++ b/src/ids.rs @@ -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 {