Skip to main content

DocumentRun

Struct DocumentRun 

Source
pub struct DocumentRun<'a> { /* private fields */ }
Expand description

A document run with path roles made explicit.

config_path is a logical identity used by per-file configuration. A separate source_file is exposed to rules that may access the filesystem. Native adapters usually set both; browser and other virtual adapters set only config_path.

Implementations§

Source§

impl<'a> DocumentRun<'a>

Source

pub fn new( content: &'a str, rules: &'a [Box<dyn Rule>], config: &'a Config, ) -> Self

Source

pub fn file_path(self, path: &'a Path) -> Self

Set a real file path for both per-file configuration and rule filesystem access.

Source

pub fn config_path(self, path: Option<&'a Path>) -> Self

Set a logical path used only for per-file configuration matching.

Source

pub fn source_file(self, path: Option<&'a Path>) -> Self

Set the filesystem path visible to rules independently of configuration matching.

Source

pub fn verbose(self, verbose: bool) -> Self

Source

pub fn flavor(&self) -> MarkdownFlavor

Source

pub fn analyze(&self) -> Result<DocumentAnalysis, LintError>

Source

pub fn analyze_raw(&self) -> (Result<Vec<LintWarning>, LintError>, FileIndex)

Source

pub fn fix(&self, max_iterations: usize) -> Result<(String, FixResult), String>

Apply every fix and return the document in its own line-ending convention.

Rules fix LF text: a fix() that rebuilds the document joins its lines with \n, and an inserted line ending is \n. The CLI normalises a file to LF before it gets here and restores the ending on write; the same happens here for every caller (LSP, wasm), so a CRLF document comes back CRLF, and one with mixed endings comes back LF exactly as rumdl fmt writes it. A document nothing changed comes back byte-identical.

Source

pub fn config_path_buf(&self) -> Option<PathBuf>

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for DocumentRun<'a>

§

impl<'a> !UnwindSafe for DocumentRun<'a>

§

impl<'a> Freeze for DocumentRun<'a>

§

impl<'a> Send for DocumentRun<'a>

§

impl<'a> Sync for DocumentRun<'a>

§

impl<'a> Unpin for DocumentRun<'a>

§

impl<'a> UnsafeUnpin for DocumentRun<'a>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more