Skip to content

Commit

Permalink
Improved documentation of StreamBuilder::set_span_on_all_tokens (#69)
Browse files Browse the repository at this point in the history
Co-authored-by: Victor Koenders <[email protected]>
  • Loading branch information
VictorKoenders and Victor Koenders authored Jun 4, 2023
1 parent 3cfd903 commit 7eb6765
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/generate/stream_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,19 @@ impl StreamBuilder {
}

/// Set the given span on all tokens in the stream. This span is used by rust for e.g. compiler errors, to indicate the position of the error.
///
/// Normally your derive will report an error on the derive, e.g.:
///
/// ```text
/// #[derive(YourMacro)]
/// ^^^^^^^^^
/// |
/// `self` value is a keyword only available in methods with a `self` parameter
/// ```
///
/// If you want to improve feedback to the user of your macro, you can use this macro to set the location for a given streambuilder.
///
/// A `span` can be obtained from e.g. an ident with `ident.span()`.
pub fn set_span_on_all_tokens(&mut self, span: Span) {
self.stream = std::mem::take(&mut self.stream)
.into_iter()
Expand Down

0 comments on commit 7eb6765

Please sign in to comment.