pub struct MarkdownReview { /* private fields */ }Expand description
Mutable collection of Markdown review comments.
Implementations§
Source§impl MarkdownReview
impl MarkdownReview
Sourcepub fn add_comment(
&mut self,
anchor: MarkdownAnchor,
body: impl Into<String>,
) -> u64
pub fn add_comment( &mut self, anchor: MarkdownAnchor, body: impl Into<String>, ) -> u64
Adds a comment with the context available in its anchor.
Sourcepub fn add_comment_with_context(
&mut self,
anchor: MarkdownAnchor,
context: MarkdownCommentContext,
body: impl Into<String>,
) -> u64
pub fn add_comment_with_context( &mut self, anchor: MarkdownAnchor, context: MarkdownCommentContext, body: impl Into<String>, ) -> u64
Adds a comment with an explicitly captured context.
Sourcepub fn add_comment_for_target(
&mut self,
document: &MarkdownDocument,
target: MarkdownTargetId,
body: impl Into<String>,
) -> Option<u64>
pub fn add_comment_for_target( &mut self, document: &MarkdownDocument, target: MarkdownTargetId, body: impl Into<String>, ) -> Option<u64>
Creates an anchor and captures all context for a document target.
Sourcepub fn edit_comment(&mut self, id: u64, body: impl Into<String>) -> bool
pub fn edit_comment(&mut self, id: u64, body: impl Into<String>) -> bool
Changes a comment body, returning whether the ID existed.
Sourcepub fn remove_comment(&mut self, id: u64) -> Option<MarkdownReviewComment>
pub fn remove_comment(&mut self, id: u64) -> Option<MarkdownReviewComment>
Removes a comment, returning it if present.
pub fn comment(&self, id: u64) -> Option<&MarkdownReviewComment>
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn outdated_count(&self) -> usize
Sourcepub fn comments(&self) -> &[MarkdownReviewComment]
pub fn comments(&self) -> &[MarkdownReviewComment]
Returns comments in insertion order.
Sourcepub fn iter(&self) -> impl Iterator<Item = &MarkdownReviewComment>
pub fn iter(&self) -> impl Iterator<Item = &MarkdownReviewComment>
Iterates over comments in insertion order.
Sourcepub fn comments_for_anchor<'a>(
&'a self,
anchor: &MarkdownAnchor,
) -> impl DoubleEndedIterator
pub fn comments_for_anchor<'a>( &'a self, anchor: &MarkdownAnchor, ) -> impl DoubleEndedIterator
Returns comments associated with an exact durable anchor.
Sourcepub fn comments_for_target<'a>(
&'a self,
document: &'a MarkdownDocument,
target: MarkdownTargetId,
) -> IntoIter<&'a MarkdownReviewComment> ⓘ
pub fn comments_for_target<'a>( &'a self, document: &'a MarkdownDocument, target: MarkdownTargetId, ) -> IntoIter<&'a MarkdownReviewComment> ⓘ
Returns comments associated with a target in document.
Sourcepub fn most_recent_comment_id(&self) -> Option<u64>
pub fn most_recent_comment_id(&self) -> Option<u64>
Returns the most recently inserted comment ID.
Sourcepub fn reconcile(&mut self, document: &MarkdownDocument)
pub fn reconcile(&mut self, document: &MarkdownDocument)
Reattaches comments to a replacement document and marks misses outdated.
Sourcepub fn submission(
&self,
decision: MarkdownReviewDecision,
) -> MarkdownReviewSubmission
pub fn submission( &self, decision: MarkdownReviewDecision, ) -> MarkdownReviewSubmission
Produces a submission. Call Self::try_submission when comments may
have been inserted without a session draft.
Sourcepub fn try_submission(
&self,
decision: MarkdownReviewDecision,
) -> Result<MarkdownReviewSubmission, MarkdownReviewError>
pub fn try_submission( &self, decision: MarkdownReviewDecision, ) -> Result<MarkdownReviewSubmission, MarkdownReviewError>
Produces a submission after validating that every body is nonblank.
§Errors
Returns MarkdownReviewError::BlankComment when a comment body contains
no non-whitespace characters.
Trait Implementations§
Source§impl Clone for MarkdownReview
impl Clone for MarkdownReview
Source§fn clone(&self) -> MarkdownReview
fn clone(&self) -> MarkdownReview
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MarkdownReview
impl Debug for MarkdownReview
Source§impl Default for MarkdownReview
impl Default for MarkdownReview
Source§fn default() -> MarkdownReview
fn default() -> MarkdownReview
Source§impl<'de> Deserialize<'de> for MarkdownReview
impl<'de> Deserialize<'de> for MarkdownReview
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MarkdownReview, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MarkdownReview, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for MarkdownReview
Source§impl PartialEq for MarkdownReview
impl PartialEq for MarkdownReview
Source§impl Serialize for MarkdownReview
impl Serialize for MarkdownReview
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for MarkdownReview
Auto Trait Implementations§
impl Freeze for MarkdownReview
impl RefUnwindSafe for MarkdownReview
impl Send for MarkdownReview
impl Sync for MarkdownReview
impl Unpin for MarkdownReview
impl UnsafeUnpin for MarkdownReview
impl UnwindSafe for MarkdownReview
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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