pub struct EditPlan {
pub schema_version: u32,
pub source_sha256: Option<String>,
pub author: String,
pub date: Option<String>,
pub initials: Option<String>,
pub resolve_revisions: Option<ResolveRevisions>,
pub removed_anchor_comments: RemovedAnchorComments,
pub existing_revisions: ExistingRevisions,
pub operations: Vec<Operation>,
pub update_fields: bool,
pub rewrite_others_comments: bool,
pub others: Others,
}Expand description
A versioned, portable set of operations against one document snapshot.
Fields§
§schema_version: u32Wire schema version; must equal SCHEMA_VERSION.
source_sha256: Option<String>SHA-256 of the source bytes; when present the plan is refused unless it matches. Omit only when the caller owns the bytes end to end.
Revision and comment author.
date: Option<String>Revision and comment timestamp (YYYY-MM-DDTHH:MM:SSZ). When
omitted, everything the plan writes takes the time it is applied, in
UTC, as Word dates its changes; set it for reproducible output.
initials: Option<String>Comment initials; derived from author when omitted.
resolve_revisions: Option<ResolveRevisions>Tracked changes to accept and reject before anything else; the
changes it leaves follow existing_revisions.
removed_anchor_comments: RemovedAnchorCommentsRemove threads whose anchors disappear (default), or keep them on empty, untracked anchors at the removed text’s position.
existing_revisions: ExistingRevisionsWhat to do when the source already holds tracked changes.
operations: Vec<Operation>Operations in report order.
update_fields: boolRefresh PAGEREF, REF, NUMPAGES, SEQ and TOC results in the
edited copy from jubarte’s layout (crate::fields::update_fields)
before the redline is compared.
rewrite_others_comments: boolAccepted and ignored. Deleting, resolving or rewording another
author’s comment is allowed unless Others::Keep is set. The
field stays so a plan that still names it parses.
others: OthersWhen keep, refuse to erase another author’s change
(CHANGE_NOT_YOURS) or comment (COMMENT_NOT_YOURS). The default
allow permits both. Restore, strike, a comment and a reply stay
allowed either way.
Implementations§
Source§impl EditPlan
impl EditPlan
Sourcepub fn from_json(json: &str) -> Result<EditPlan, EditError>
pub fn from_json(json: &str) -> Result<EditPlan, EditError>
Parse and validate a plan’s JSON. A field read as another (anchor
as find, …) is read without its note: Self::from_json_with_notes
returns the notes, and apply_plan_json puts them in
EditReport.notes.
§Errors
Sourcepub fn from_json_with_notes(
json: &str,
) -> Result<(EditPlan, Vec<String>), EditError>
pub fn from_json_with_notes( json: &str, ) -> Result<(EditPlan, Vec<String>), EditError>
Parse and validate a plan’s JSON, with a note for each field read
as another: anchor as find on replace, delete and comment,
and comment as text on comment and reply_comment.
§Errors
INVALID_PLAN when the JSON is malformed or more than one value,
lacks schema_version, or names an unknown field or operation kind:
the message names the operation, its kind, the fields the kind takes
and the nearest one. UNSUPPORTED_SCHEMA when schema_version
differs from SCHEMA_VERSION.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for EditPlan
impl<'de> Deserialize<'de> for EditPlan
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<EditPlan, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<EditPlan, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for EditPlan
Source§impl Serialize for EditPlan
impl Serialize for EditPlan
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for EditPlan
Auto Trait Implementations§
impl Forget for EditPlan
impl Freeze for EditPlan
impl Move for EditPlan
impl RefUnwindSafe for EditPlan
impl Send for EditPlan
impl Sync for EditPlan
impl Unpin for EditPlan
impl UnsafeUnpin for EditPlan
impl UnwindSafe for EditPlan
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.