Skip to content

docs: Describe Origin::primary #238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/snippet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,9 @@ impl<'a> Annotation<'a> {
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
#[non_exhaustive]
pub enum AnnotationKind {
/// Match the primary [`Level`] of the group.
/// Shows the source that the [Group's Title][Group::with_title] references
///
/// See [`Group::with_level`] for details about how this is determined
/// For [`Title`]-less groups, see [`Group::with_level`]
Primary,
/// Additional context to explain the [`Primary`][Self::Primary]
/// [`Annotation`]
Expand Down Expand Up @@ -396,17 +396,13 @@ impl<'a> Origin<'a> {
}

/// Set the default line number to display
///
/// Otherwise this will be inferred from the primary [`Annotation`]
pub fn line(mut self, line: usize) -> Self {
self.line = Some(line);
self
}

/// Set the default column to display
///
/// Otherwise this will be inferred from the primary [`Annotation`]
///
/// <div class="warning">
///
/// `char_column` is only be respected if [`Origin::line`] is also set.
Expand All @@ -417,6 +413,7 @@ impl<'a> Origin<'a> {
self
}

/// Mark this as the source that the [Group's Title][Group::with_title] references
pub fn primary(mut self, primary: bool) -> Self {
self.primary = primary;
self
Expand Down