Skip to content

Commit

Permalink
Improve links in docs for generated named arguments structs
Browse files Browse the repository at this point in the history
Probably needs rust-lang/rust#74563 for
the original intended behaviour.
  • Loading branch information
csnover committed Aug 30, 2022
1 parent be29e24 commit 0165f21
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion binrw/src/binread/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ binread_nonzero_impl! {
NonZeroI8, i8, NonZeroI16, i16, NonZeroI32, i32, NonZeroI64, i64, NonZeroI128, i128,
}

/// Named arguments for [`Vec::read_options()`].
/// Named arguments for the [`BinRead::read_options()`] implementation of [`Vec`].
///
/// # Examples
///
Expand Down
14 changes: 8 additions & 6 deletions binrw_derive/src/codegen/typed_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,16 @@ impl<'a> Builder<'a> {

let res_struct = if define_result {
let docs = self.owner_name.map(|owner_name| {
let (impl_name, impl_fn) = if self.is_write {
("BinWrite", "write_options")
} else {
("BinRead", "read_options")
};
format!(
"Named arguments for [`{}::{}`].",
"Named arguments for the [`{0}::{1}`](::binrw::{0}::{1}) implementation of [`{2}`].",
impl_name,
impl_fn,
owner_name,
if self.is_write {
"write_options"
} else {
"read_options"
}
)
});

Expand Down

0 comments on commit 0165f21

Please sign in to comment.