Skip to main content

DryRun

Struct DryRun 

Source
pub struct DryRun<'s>(/* private fields */);
Expand description

The dry-run view of the document operations (spec/surface §4, 1.3; the reference’s DocOpContext.dryRun): the same four calls as on Store, each validating exactly as the real run does (doc_missing, path_taken, …), writing and committing nothing, and returning committed: false with the per-file diffs. A create still mints its d_ id (apply’s rule: a dry run consumes the id the real run would take next). Obtained from Store::dry_run.

Implementations§

Source§

impl DryRun<'_>

Source

pub fn docs_create( &mut self, ctx: &DocOpContext, doc_store: &mut dyn DocStore, path: &str, markdown: &str, frontmatter: Option<&Map<String, Value>>, ) -> Result<DocOpResult>

docs_create without writing: { "<path>": { before: "", after: bytes } }.

Source

pub fn docs_move( &mut self, ctx: &DocOpContext, doc_store: &mut dyn DocStore, doc_ref: &str, to_path: &str, retarget_inbound: bool, ) -> Result<DocMoveResult>

docs_move without renaming: the old path → "", the new path ← bytes; with retarget_inbound, dangling/retargeted as the real run would report them and the rewritten sources’ diffs.

Source

pub fn docs_delete( &mut self, ctx: &DocOpContext, doc_store: &mut dyn DocStore, doc_ref: &str, ) -> Result<DocOpResult>

docs_delete without deleting: { "<path>": { before: bytes, after: "" } }.

Source

pub fn docs_set_meta( &mut self, ctx: &DocOpContext, doc_store: &mut dyn DocStore, doc_ref: &str, set: Option<&Map<String, Value>>, unset: &[String], ) -> Result<DocOpResult>

docs_set_meta without writing: the file before → after the patch.

Trait Implementations§

Source§

impl Debug for DryRun<'_>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'s> !RefUnwindSafe for DryRun<'s>

§

impl<'s> !Send for DryRun<'s>

§

impl<'s> !Sync for DryRun<'s>

§

impl<'s> !UnwindSafe for DryRun<'s>

§

impl<'s> Freeze for DryRun<'s>

§

impl<'s> Unpin for DryRun<'s>

§

impl<'s> UnsafeUnpin for DryRun<'s>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.