pub struct EntityDiff { /* private fields */ }Expand description
Performs a diff between two entities, and contains the resulting JSON for use in wbeditentity
Implementations§
Source§impl EntityDiff
impl EntityDiff
Sourcepub fn new(i1: &Entity, i2: &Entity, params: &EntityDiffParams) -> EntityDiff
pub fn new(i1: &Entity, i2: &Entity, params: &EntityDiffParams) -> EntityDiff
Perform a diff, and return a new EntityDiff with the result
pub fn new_as_result( i1: &Entity, i2: &Entity, params: &EntityDiffParams, ) -> Result<EntityDiff, Vec<String>>
Sourcepub fn actions_mut(&mut self) -> &mut Value
pub fn actions_mut(&mut self) -> &mut Value
The JSON resulting from the diff, for use in wbeditentity, as mutable
Sourcepub fn to_string_pretty(&self) -> Result<String, Error>
pub fn to_string_pretty(&self) -> Result<String, Error>
The JSON resulting from the diff, as a pretty (printable) String
pub fn edit_summary(&self) -> &Option<String>
pub fn set_edit_summary(&mut self, edit_summary: Option<String>)
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Checks if the result from the diff is empty (=> no action needs to be taken)
Sourcepub fn edit_target(&self) -> &EditTarget
pub fn edit_target(&self) -> &EditTarget
Return the current edit target
Sourcepub fn set_edit_target(&mut self, edit_target: EditTarget)
pub fn set_edit_target(&mut self, edit_target: EditTarget)
Set the current edit target
Sourcepub async fn apply_diff(
&self,
mw_api: &mut Api,
diff: &EntityDiff,
) -> Result<Value, WikibaseError>
pub async fn apply_diff( &self, mw_api: &mut Api, diff: &EntityDiff, ) -> Result<Value, WikibaseError>
Applied the diff to the Wikibase entity online, via wbeditentity
Sourcepub fn get_entity_id(entity_json: &Value) -> Option<String>
pub fn get_entity_id(entity_json: &Value) -> Option<String>
Returns the entity ID (String) from a JSON result.
Intended to get the ID on a new entity, which is stored in the result of apply_diff
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EntityDiff
impl RefUnwindSafe for EntityDiff
impl Send for EntityDiff
impl Sync for EntityDiff
impl Unpin for EntityDiff
impl UnsafeUnpin for EntityDiff
impl UnwindSafe for EntityDiff
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more