8000 chore: Improve docs arount Origin and Snippet · Muscraft/annotate-snippets-rs@8df4d37 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8df4d37

Browse files
committed
chore: Improve docs arount Origin and Snippet
1 parent 7305271 commit 8df4d37

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/snippet.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ pub struct Title<'a> {
162162
}
163163

164164
/// A source view [`Element`] in a [`Group`]
165+
///
166+
/// If you do not have [source][Snippet::source] available, see instead [`Origin`]
165167
#[derive(Clone, Debug)]
166168
pub struct Snippet<'a, T> {
167169
pub(crate) path: Option<&'a str>,
@@ -375,7 +377,9 @@ impl<'a> Patch<'a> {
375377
}
376378
}
377379

378-
/// The location of the [`Snippet`] (e.g. a path)
380+
/// The referenced location (e.g. a path)
381+
///
382+
/// If you have source available, see instead [`Snippet`]
379383
#[derive(Clone, Debug)]
380384
pub struct Origin<'a> {
381385
pub(crate) path: &'a str,
@@ -412,6 +416,12 @@ impl<'a> Origin<'a> {
412416
/// Set the default column to display
413417
///
414418
/// Otherwise this will be inferred from the primary [`Annotation`]
419+
///
420+
/// <div class="warning">
421+
///
422+
/// `char_column` is only be respected if [`Origin::line`] is also set.
423+
///
424+
/// </div>
415425
pub fn char_column(mut self, char_column: usize) -> Self {
416426
self.char_column = Some(char_column);
417427
self

0 commit comments

Comments
 (0)
0