Skip to main content

ProtectionKind

Enum ProtectionKind 

Source
pub enum ProtectionKind {
    ReadOnly,
    Comments,
    TrackedChanges,
    Forms,
}
Expand description

Which editing restrictions are enforced on a document (w:documentProtection/@w:edit, ST_DocProtect) once Document.protection is Some. ST_DocProtect’s "none" value isn’t modeled as its own variant — Document.protection: Option::None already expresses “no restriction”, same convention as Highlight’s "none"/ VerticalAlign’s "baseline"/UnderlineStyle’s "none" elsewhere in this crate.

Variants§

§

ReadOnly

Edits are restricted to regions delimited by matching range permissions — in practice, with none declared (this crate doesn’t model range permissions), this means no editing at all.

§

Comments

Edits are restricted to inserting/deleting comments (plus the same range-permission carve-out as ReadOnly).

§

TrackedChanges

Edits are tracked as revisions, and applications shouldn’t allow turning tracking back off while this is enforced — per ECMA-376, this value “shall imply the presence of the trackRevisions element”, though this crate does not automatically set Document.track_changes when this variant is used (best-effort, not validated, same posture as Hyperlink::Internal’s anchor not being checked against a real bookmark).

§

Forms

Edits are restricted to form fields in sections marked as form-protected (this crate doesn’t model per-section formProt, so in practice this behaves like ReadOnly for any document it writes).

Implementations§

Source§

impl ProtectionKind

Source

pub fn attribute_value(self) -> &'static str

This kind’s w:edit attribute value (ST_DocProtect).

Source

pub fn from_attribute_value(value: &str) -> Option<ProtectionKind>

Parses a w:edit attribute value (ST_DocProtect) into a ProtectionKind, or None for "none" or any unrecognized value — mirrors this crate’s usual forgiving-on-read policy.

Trait Implementations§

Source§

impl Clone for ProtectionKind

Source§

fn clone(&self) -> ProtectionKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ProtectionKind

Source§

impl Debug for ProtectionKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for ProtectionKind

Source§

impl PartialEq for ProtectionKind

Source§

fn eq(&self, other: &ProtectionKind) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ProtectionKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.