pub struct Entity {
pub id: WikiId,
pub claims: Vec<(Pid, ClaimValue)>,
pub entity_type: EntityType,
pub descriptions: BTreeMap<Lang, String>,
pub labels: BTreeMap<Lang, String>,
pub aliases: BTreeMap<Lang, Vec<String>>,
pub sitelinks: BTreeMap<SiteName, SitelinkValue>,
}
Expand description
A Wikibase entity: this could be an entity, property, or lexeme.
Fields§
§id: WikiId
Unique identifier
claims: Vec<(Pid, ClaimValue)>
All of the claims on the entity.
entity_type: EntityType
The type of the entity.
descriptions: BTreeMap<Lang, String>
All of the descriptions in all known languages.
labels: BTreeMap<Lang, String>
All of the labels in all known languages.
aliases: BTreeMap<Lang, Vec<String>>
Known aliases of the item.
sitelinks: BTreeMap<SiteName, SitelinkValue>
site links (e.g. to wikipedia, wikivoyage, …)
Implementations§
source§impl Entity
impl Entity
sourcepub fn start_time(&self) -> Option<DateTime<Utc>>
pub fn start_time(&self) -> Option<DateTime<Utc>>
When the entity started existing.
sourcepub fn from_json(json: Value) -> Result<Self, EntityError>
pub fn from_json(json: Value) -> Result<Self, EntityError>
Construct an entity from the Wikibase JSON repersentation. The input can either be an
object directly containing the Wikibase entity representation, or a multi-entity object
returned by some endpoints such as Special:EntityData
. Multi-entity objects must only
contain one entity.
§Errors
If the JSON reperesntation can’t be parsed to an Entity
, an EntityError
will be returned.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Entity
impl<'de> Deserialize<'de> for Entity
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for Entity
impl PartialEq for Entity
impl StructuralPartialEq for Entity
Auto Trait Implementations§
impl Freeze for Entity
impl RefUnwindSafe for Entity
impl Send for Entity
impl Sync for Entity
impl Unpin for Entity
impl UnwindSafe for Entity
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more