pub struct MarkdownReviewSession { /* private fields */ }Expand description
State for reviewing one parsed Markdown document.
Implementations§
Source§impl MarkdownReviewSession
impl MarkdownReviewSession
pub fn new(document: Arc<MarkdownDocument>) -> MarkdownReviewSession
pub const fn document(&self) -> &Arc<MarkdownDocument> ⓘ
pub const fn review(&self) -> &MarkdownReview
pub const fn review_mut(&mut self) -> &mut MarkdownReview
pub const fn selected_target(&self) -> Option<MarkdownTargetId>
pub fn selected_target_info(&self) -> Option<&MarkdownTarget>
pub fn selected_anchor(&self) -> Option<MarkdownAnchor>
pub const fn draft(&self) -> Option<&MarkdownCommentDraft>
pub const fn draft_mut(&mut self) -> Option<&mut MarkdownCommentDraft>
Sourcepub fn select_target(&mut self, target: MarkdownTargetId) -> bool
pub fn select_target(&mut self, target: MarkdownTargetId) -> bool
Selects a target from this document.
Sourcepub fn select(&mut self, target: MarkdownTargetId) -> bool
pub fn select(&mut self, target: MarkdownTargetId) -> bool
Alias for Self::select_target useful to frontend adapters.
Sourcepub fn move_by(&mut self, delta: isize) -> Option<MarkdownTargetId>
pub fn move_by(&mut self, delta: isize) -> Option<MarkdownTargetId>
Moves one target forward or backward.
Sourcepub fn last_comment_id(&self) -> Option<u64>
pub fn last_comment_id(&self) -> Option<u64>
Returns the most recently added comment at the current selection.
Sourcepub fn selected_comments(&self) -> IntoIter<&MarkdownReviewComment> ⓘ
pub fn selected_comments(&self) -> IntoIter<&MarkdownReviewComment> ⓘ
Returns comments attached to the current selection.
Sourcepub fn move_target(&mut self, delta: isize) -> Option<MarkdownTargetId>
pub fn move_target(&mut self, delta: isize) -> Option<MarkdownTargetId>
Moves through commentable targets, clamping at either end.
Sourcepub fn select_boundary(&mut self, last: bool) -> Option<MarkdownTargetId>
pub fn select_boundary(&mut self, last: bool) -> Option<MarkdownTargetId>
Selects the first or last target.
pub fn select_first_target(&mut self) -> Option<MarkdownTargetId>
pub fn select_last_target(&mut self) -> Option<MarkdownTargetId>
Sourcepub fn next_heading(&mut self) -> Option<MarkdownTargetId>
pub fn next_heading(&mut self) -> Option<MarkdownTargetId>
Selects the next heading after the current target.
Sourcepub fn previous_heading(&mut self) -> Option<MarkdownTargetId>
pub fn previous_heading(&mut self) -> Option<MarkdownTargetId>
Selects the previous heading before the current target.
Sourcepub fn begin_draft(&mut self, editing: Option<u64>) -> bool
pub fn begin_draft(&mut self, editing: Option<u64>) -> bool
Begins a new draft on the current target, or edits an existing comment.
pub fn cancel_draft(&mut self)
Sourcepub fn submit_draft(&mut self) -> Option<u64>
pub fn submit_draft(&mut self) -> Option<u64>
Saves the active draft, returning its comment ID. Blank drafts are discarded.
pub fn comment_id_at_selection(&self) -> Option<u64>
pub fn edit_comment_at_selection(&mut self) -> bool
pub fn delete_comment_at_selection(&mut self) -> bool
Sourcepub fn undo_last_comment(&mut self) -> bool
pub fn undo_last_comment(&mut self) -> bool
Removes the most recently added comment, if there is one.
pub fn clear_review(&mut self)
Sourcepub fn replace_document(&mut self, document: Arc<MarkdownDocument>)
pub fn replace_document(&mut self, document: Arc<MarkdownDocument>)
Replaces the document, reconciles comments, and preserves selection when possible.
Sourcepub fn set_document(&mut self, document: Arc<MarkdownDocument>)
pub fn set_document(&mut self, document: Arc<MarkdownDocument>)
Alias for Self::replace_document used by host adapters.
Sourcepub fn submission(
&self,
decision: MarkdownReviewDecision,
) -> MarkdownReviewSubmission
pub fn submission( &self, decision: MarkdownReviewDecision, ) -> MarkdownReviewSubmission
Builds a submission for an explicit decision.
Sourcepub fn submit(
&self,
decision: MarkdownReviewDecision,
) -> Result<MarkdownReviewEvent, MarkdownReviewError>
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.
Sourcepub fn approve(&self) -> Result<MarkdownReviewEvent, MarkdownReviewError>
pub fn approve(&self) -> Result<MarkdownReviewEvent, MarkdownReviewError>
Sourcepub fn request_changes(
&self,
) -> Result<MarkdownReviewEvent, MarkdownReviewError>
pub fn request_changes( &self, ) -> Result<MarkdownReviewEvent, MarkdownReviewError>
Sourcepub fn approve_submission(
&self,
) -> Result<MarkdownReviewSubmission, MarkdownReviewError>
pub fn approve_submission( &self, ) -> Result<MarkdownReviewSubmission, MarkdownReviewError>
Sourcepub fn request_changes_submission(
&self,
) -> Result<MarkdownReviewSubmission, MarkdownReviewError>
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.
pub fn cancel(&self) -> MarkdownReviewEvent
pub fn copy_formatted( &self, decision: MarkdownReviewDecision, ) -> MarkdownReviewEvent
Trait Implementations§
Source§impl Clone for MarkdownReviewSession
impl Clone for MarkdownReviewSession
Source§fn clone(&self) -> MarkdownReviewSession
fn clone(&self) -> MarkdownReviewSession
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for MarkdownReviewSession
impl RefUnwindSafe for MarkdownReviewSession
impl Send for MarkdownReviewSession
impl Sync for MarkdownReviewSession
impl Unpin for MarkdownReviewSession
impl UnsafeUnpin for MarkdownReviewSession
impl UnwindSafe for MarkdownReviewSession
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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