expand Entity::from_json docs

This commit is contained in:
Smitty 2021-12-26 12:36:43 -05:00
parent bddc2c0b31
commit c53655bc52

View file

@ -224,10 +224,13 @@ impl Entity {
None None
} }
/// Construct an entity from the Wikibase JSON repersentation. /// 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 /// # Errors
/// If the JSON reperesntation can't be parsed to an `Entity` an `EntityError` will be returned. /// If the JSON reperesntation can't be parsed to an `Entity`, an `EntityError` will be returned.
pub fn from_json(mut json: Value) -> Result<Self, EntityError> { pub fn from_json(mut json: Value) -> Result<Self, EntityError> {
let mut json = match json.get_mut("entities") { let mut json = match json.get_mut("entities") {
Some(ents) => { Some(ents) => {