Skip to content

Commit

Permalink
Add documentation to generated public items (#236)
Browse files Browse the repository at this point in the history
Fixes #235
  • Loading branch information
ia0 authored Apr 17, 2024
1 parent eeb6e9d commit 7ef8801
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions derive/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ fn generate_checked_bit_pattern_struct(

Ok((
quote! {
#[doc = #GENERATED_TYPE_DOCUMENTATION]
#repr
#[derive(Clone, Copy, #crate_name::AnyBitPattern)]
#derive_dbg
Expand Down Expand Up @@ -652,6 +653,7 @@ fn generate_checked_bit_pattern_enum_with_fields(

Ok((
quote! {
#[doc = #GENERATED_TYPE_DOCUMENTATION]
#[derive(::core::clone::Clone, ::core::marker::Copy, #crate_name::AnyBitPattern)]
#derive_dbg
#bits_repr
Expand Down Expand Up @@ -703,6 +705,7 @@ fn generate_checked_bit_pattern_enum_with_fields(

Ok((
quote! {
#[doc = #GENERATED_TYPE_DOCUMENTATION]
#[derive(::core::clone::Clone, ::core::marker::Copy, #crate_name::CheckedBitPattern)]
#[repr(C)]
#vis struct #bits_ty(#(#fields),*);
Expand Down Expand Up @@ -775,6 +778,7 @@ fn generate_checked_bit_pattern_enum_with_fields(

Ok((
quote! {
#[doc = #GENERATED_TYPE_DOCUMENTATION]
#[derive(::core::clone::Clone, ::core::marker::Copy, #crate_name::AnyBitPattern)]
#bits_repr
#[allow(non_snake_case)]
Expand Down Expand Up @@ -1263,3 +1267,6 @@ pub fn bytemuck_crate_name(input: &DeriveInput) -> TokenStream {

return crate_name;
}

const GENERATED_TYPE_DOCUMENTATION: &str =
" `bytemuck`-generated type for internal purposes only.";

0 comments on commit 7ef8801

Please sign in to comment.