Skip to main content

Payload

Trait Payload 

Source
pub(crate) trait Payload {
    // Required methods
    fn line_ending(&self) -> LineEndingSpec;
    fn reconcile(&self, source: &Source<'_>) -> Result<Vec<u8>, DocumentError>;
    fn validate(&self) -> Result<(), DocumentError>;
}
Expand description

What every kind of document declares and does.

Required Methods§

Source

fn line_ending(&self) -> LineEndingSpec

The line ending of the written document.

Source

fn reconcile(&self, source: &Source<'_>) -> Result<Vec<u8>, DocumentError>

Reconcile the document against its current source.

§Errors

Returns an error for malformed source, values the document cannot represent, or an incompatible merge.

Source

fn validate(&self) -> Result<(), DocumentError>

Check the declaration without reading any source.

§Errors

Returns an error for invalid ownership paths, for comment nodes that cannot be rendered and for invalid Markdown selectors.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§