Skip to main content

MarkdownReviewSession

Struct MarkdownReviewSession 

Source
pub struct MarkdownReviewSession { /* private fields */ }
Expand description

State for reviewing one parsed Markdown document.

Implementations§

Source§

impl MarkdownReviewSession

Source

pub fn new(document: Arc<MarkdownDocument>) -> MarkdownReviewSession

Source

pub const fn document(&self) -> &Arc<MarkdownDocument>

Source

pub const fn review(&self) -> &MarkdownReview

Source

pub const fn review_mut(&mut self) -> &mut MarkdownReview

Source

pub const fn selected_target(&self) -> Option<MarkdownTargetId>

Source

pub fn selected_target_info(&self) -> Option<&MarkdownTarget>

Source

pub fn selected_anchor(&self) -> Option<MarkdownAnchor>

Source

pub const fn draft(&self) -> Option<&MarkdownCommentDraft>

Source

pub const fn draft_mut(&mut self) -> Option<&mut MarkdownCommentDraft>

Source

pub fn select_target(&mut self, target: MarkdownTargetId) -> bool

Selects a target from this document.

Source

pub fn select(&mut self, target: MarkdownTargetId) -> bool

Alias for Self::select_target useful to frontend adapters.

Source

pub fn move_by(&mut self, delta: isize) -> Option<MarkdownTargetId>

Moves one target forward or backward.

Source

pub fn last_comment_id(&self) -> Option<u64>

Returns the most recently added comment at the current selection.

Source

pub fn selected_comments(&self) -> IntoIter<&MarkdownReviewComment>

Returns comments attached to the current selection.

Source

pub fn move_target(&mut self, delta: isize) -> Option<MarkdownTargetId>

Moves through commentable targets, clamping at either end.

Source

pub fn select_boundary(&mut self, last: bool) -> Option<MarkdownTargetId>

Selects the first or last target.

Source

pub fn select_first_target(&mut self) -> Option<MarkdownTargetId>

Source

pub fn select_last_target(&mut self) -> Option<MarkdownTargetId>

Source

pub fn next_heading(&mut self) -> Option<MarkdownTargetId>

Selects the next heading after the current target.

Source

pub fn previous_heading(&mut self) -> Option<MarkdownTargetId>

Selects the previous heading before the current target.

Source

pub fn begin_draft(&mut self, editing: Option<u64>) -> bool

Begins a new draft on the current target, or edits an existing comment.

Source

pub fn cancel_draft(&mut self)

Source

pub fn submit_draft(&mut self) -> Option<u64>

Saves the active draft, returning its comment ID. Blank drafts are discarded.

Source

pub fn comment_id_at_selection(&self) -> Option<u64>

Source

pub fn edit_comment_at_selection(&mut self) -> bool

Source

pub fn delete_comment_at_selection(&mut self) -> bool

Source

pub fn undo_last_comment(&mut self) -> bool

Removes the most recently added comment, if there is one.

Source

pub fn clear_review(&mut self)

Source

pub fn replace_document(&mut self, document: Arc<MarkdownDocument>)

Replaces the document, reconciles comments, and preserves selection when possible.

Source

pub fn set_document(&mut self, document: Arc<MarkdownDocument>)

Alias for Self::replace_document used by host adapters.

Source

pub fn submission( &self, decision: MarkdownReviewDecision, ) -> MarkdownReviewSubmission

Builds a submission for an explicit decision.

Source

pub fn submit( &self, decision: MarkdownReviewDecision, ) -> Result<MarkdownReviewEvent, MarkdownReviewError>

Builds an explicit submission event for either decision.

§Errors

Returns an error when a comment body is blank.

Source

pub fn approve(&self) -> Result<MarkdownReviewEvent, MarkdownReviewError>

Builds an explicit approval event.

§Errors

Returns an error when a comment body is blank.

Source

pub fn request_changes( &self, ) -> Result<MarkdownReviewEvent, MarkdownReviewError>

Builds an explicit request-changes event.

§Errors

Returns an error when a comment body is blank.

Source

pub fn approve_submission( &self, ) -> Result<MarkdownReviewSubmission, MarkdownReviewError>

Builds an explicit approval submission.

§Errors

Returns an error when a comment body is blank.

Source

pub fn request_changes_submission( &self, ) -> Result<MarkdownReviewSubmission, MarkdownReviewError>

Builds an explicit request-changes submission.

§Errors

Returns an error when a comment body is blank.

Source

pub fn cancel(&self) -> MarkdownReviewEvent

Source

pub fn copy_formatted( &self, decision: MarkdownReviewDecision, ) -> MarkdownReviewEvent

Trait Implementations§

Source§

impl Clone for MarkdownReviewSession

Source§

fn clone(&self) -> MarkdownReviewSession

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 Debug for MarkdownReviewSession

Source§

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

Formats the value using the given formatter. Read more

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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 = !

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.