diff options
70 files changed, 872 insertions, 809 deletions
diff --git a/src/ir/comment.rs b/src/ir/comment.rs index 1a76542c..446e10b4 100644 --- a/src/ir/comment.rs +++ b/src/ir/comment.rs @@ -38,6 +38,19 @@ fn make_indent(indent: usize) -> String { iter::repeat(' ').take(indent * RUST_INDENTATION).collect() } +/// For a comment like `/// foo`, proc_macro2 will turn it into +/// `#[doc = " foo"]`, and rustfmt into `/// foo`, so prevent this by removing +/// the first space of the comment if present. +/// +/// This is a bit hacky. +fn format_line(line: &str) -> &str { + if line.starts_with(" ") { + &line[1..] + } else { + line + } +} + /// Preprocesses multiple single line comments. /// /// Handles lines starting with both `//` and `///`. @@ -52,7 +65,7 @@ fn preprocess_single_lines(comment: &str, indent: usize) -> String { .map(|l| { let indent = if is_first { "" } else { &*indent }; is_first = false; - format!("{}///{}", indent, l) + format!("{}///{}", indent, format_line(l)) }) .collect(); lines.join("\n") @@ -73,7 +86,7 @@ fn preprocess_multi_line(comment: &str, indent: usize) -> String { .map(|line| { let indent = if is_first { "" } else { &*indent }; is_first = false; - format!("{}///{}", indent, line) + format!("{}///{}", indent, format_line(line)) }) .collect(); @@ -97,16 +110,16 @@ mod test { #[test] fn processes_single_lines_correctly() { - assert_eq!(preprocess("/// hello", 0), "/// hello"); - assert_eq!(preprocess("// hello", 0), "/// hello"); - assert_eq!(preprocess("// hello", 0), "/// hello"); + assert_eq!(preprocess("/// hello", 0), "///hello"); + assert_eq!(preprocess("// hello", 0), "///hello"); + assert_eq!(preprocess("// hello", 0), "/// hello"); } #[test] fn processes_multi_lines_correctly() { assert_eq!( preprocess("/** hello \n * world \n * foo \n */", 0), - "/// hello\n/// world\n/// foo" + "///hello\n///world\n///foo" ); assert_eq!( diff --git a/tests/expectations/tests/accessors.rs b/tests/expectations/tests/accessors.rs index b7c41bda..df52a6d5 100644 --- a/tests/expectations/tests/accessors.rs +++ b/tests/expectations/tests/accessors.rs @@ -11,11 +11,11 @@ #[derive(Debug, Default, Copy, Clone)] pub struct SomeAccessors { pub mNoAccessor: ::std::os::raw::c_int, - #[doc = " <div rustbindgen accessor></div>"] + /// <div rustbindgen accessor></div> pub mBothAccessors: ::std::os::raw::c_int, - #[doc = " <div rustbindgen accessor=\"unsafe\"></div>"] + /// <div rustbindgen accessor="unsafe"></div> pub mUnsafeAccessors: ::std::os::raw::c_int, - #[doc = " <div rustbindgen accessor=\"immutable\"></div>"] + /// <div rustbindgen accessor="immutable"></div> pub mImmutableAccessor: ::std::os::raw::c_int, } #[test] @@ -95,7 +95,7 @@ impl SomeAccessors { &self.mImmutableAccessor } } -#[doc = " <div rustbindgen accessor></div>"] +/// <div rustbindgen accessor></div> #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct AllAccessors { @@ -153,7 +153,7 @@ impl AllAccessors { &mut self.mAlsoBothAccessors } } -#[doc = " <div rustbindgen accessor=\"unsafe\"></div>"] +/// <div rustbindgen accessor="unsafe"></div> #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct AllUnsafeAccessors { @@ -215,16 +215,16 @@ impl AllUnsafeAccessors { &mut self.mAlsoBothAccessors } } -#[doc = " <div rustbindgen accessor></div>"] +/// <div rustbindgen accessor></div> #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct ContradictAccessors { pub mBothAccessors: ::std::os::raw::c_int, - #[doc = " <div rustbindgen accessor=\"false\"></div>"] + /// <div rustbindgen accessor="false"></div> pub mNoAccessors: ::std::os::raw::c_int, - #[doc = " <div rustbindgen accessor=\"unsafe\"></div>"] + /// <div rustbindgen accessor="unsafe"></div> pub mUnsafeAccessors: ::std::os::raw::c_int, - #[doc = " <div rustbindgen accessor=\"immutable\"></div>"] + /// <div rustbindgen accessor="immutable"></div> pub mImmutableAccessor: ::std::os::raw::c_int, } #[test] @@ -310,7 +310,7 @@ impl ContradictAccessors { &self.mImmutableAccessor } } -#[doc = " <div rustbindgen accessor replaces=\"Replaced\"></div>"] +/// <div rustbindgen accessor replaces="Replaced"></div> #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Replaced { @@ -349,7 +349,7 @@ impl Replaced { &mut self.mAccessor } } -#[doc = " <div rustbindgen accessor></div>"] +/// <div rustbindgen accessor></div> #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Wrapper { diff --git a/tests/expectations/tests/annotation_hide.rs b/tests/expectations/tests/annotation_hide.rs index d6e854de..d59ed05c 100644 --- a/tests/expectations/tests/annotation_hide.rs +++ b/tests/expectations/tests/annotation_hide.rs @@ -7,7 +7,7 @@ non_upper_case_globals )] -#[doc = " <div rustbindgen opaque></div>"] +/// <div rustbindgen opaque></div> #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct D { diff --git a/tests/expectations/tests/array-of-zero-sized-types.rs b/tests/expectations/tests/array-of-zero-sized-types.rs index be8446a6..65442b94 100644 --- a/tests/expectations/tests/array-of-zero-sized-types.rs +++ b/tests/expectations/tests/array-of-zero-sized-types.rs @@ -7,7 +7,7 @@ non_upper_case_globals )] -#[doc = " This should get an `_address` byte."] +/// This should get an `_address` byte. #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Empty { @@ -26,8 +26,8 @@ fn bindgen_test_layout_Empty() { concat!("Alignment of ", stringify!(Empty)) ); } -#[doc = " This should not get an `_address` byte, since each `Empty` gets one, meaning"] -#[doc = " that this object is addressable."] +/// This should not get an `_address` byte, since each `Empty` gets one, meaning +/// that this object is addressable. #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct HasArrayOfEmpty { diff --git a/tests/expectations/tests/blacklist-and-impl-debug.rs b/tests/expectations/tests/blacklist-and-impl-debug.rs index ec757d8f..69f28a56 100644 --- a/tests/expectations/tests/blacklist-and-impl-debug.rs +++ b/tests/expectations/tests/blacklist-and-impl-debug.rs @@ -9,7 +9,7 @@ pub struct BlacklistMe(u8); -#[doc = " Because this type contains a blacklisted type, it should not derive Debug."] +/// Because this type contains a blacklisted type, it should not derive Debug. #[repr(C)] pub struct ShouldManuallyImplDebug { pub a: BlacklistMe, diff --git a/tests/expectations/tests/class_use_as.rs b/tests/expectations/tests/class_use_as.rs index b60e4780..d1f6a5c0 100644 --- a/tests/expectations/tests/class_use_as.rs +++ b/tests/expectations/tests/class_use_as.rs @@ -7,7 +7,7 @@ non_upper_case_globals )] -#[doc = " <div rustbindgen=\"true\" replaces=\"whatever\"></div>"] +/// <div rustbindgen="true" replaces="whatever"></div> #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct whatever { diff --git a/tests/expectations/tests/comment-indent.rs b/tests/expectations/tests/comment-indent.rs index 78acaf14..2e44746d 100644 --- a/tests/expectations/tests/comment-indent.rs +++ b/tests/expectations/tests/comment-indent.rs @@ -11,17 +11,17 @@ pub mod root { #[allow(unused_imports)] use self::super::root; - #[doc = " This is a multi-line doc comment."] - #[doc = ""] - #[doc = " This class is really really interesting, look!"] + /// This is a multi-line doc comment. + /// + /// This class is really really interesting, look! #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Foo { pub _address: u8, } - #[doc = " This nested class is also a multi-line doc comment."] - #[doc = ""] - #[doc = " This class is not so interesting, but worth a bit of docs too!"] + /// This nested class is also a multi-line doc comment. + /// + /// This class is not so interesting, but worth a bit of docs too! #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Foo_Bar { @@ -56,18 +56,18 @@ pub mod root { pub mod test { #[allow(unused_imports)] use self::super::super::root; - #[doc = " I\'m in a namespace, and thus I may be on a rust module, most of the time."] - #[doc = " My documentation is pretty extensive, I guess."] + /// I'm in a namespace, and thus I may be on a rust module, most of the time. + /// My documentation is pretty extensive, I guess. #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Baz { - #[doc = " This member is plain awesome, just amazing."] - #[doc = ""] - #[doc = " It also has super-extensive docs, with even a nice ascii-art diagram."] - #[doc = ""] - #[doc = " +------+ +-------+"] - #[doc = " | foo | ----> | bar |"] - #[doc = " +------+ +-------+"] + /// This member is plain awesome, just amazing. + /// + /// It also has super-extensive docs, with even a nice ascii-art diagram. + /// + /// +------+ +-------+ + /// | foo | ----> | bar | + /// +------+ +-------+ pub member: ::std::os::raw::c_int, } #[test] @@ -93,9 +93,9 @@ pub mod root { ) ); } - #[doc = " I\'m in an inline namespace, and as such I shouldn\'t get generated inside"] - #[doc = " a rust module, except when the relevant option is specified. Also, this"] - #[doc = " comment shouldn\'t be misaligned."] + /// I'm in an inline namespace, and as such I shouldn't get generated inside + /// a rust module, except when the relevant option is specified. Also, this + /// comment shouldn't be misaligned. #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct InInlineNS { diff --git a/tests/expectations/tests/constify-enum.rs b/tests/expectations/tests/constify-enum.rs index 53ef0b44..a1744a2a 100644 --- a/tests/expectations/tests/constify-enum.rs +++ b/tests/expectations/tests/constify-enum.rs @@ -19,6 +19,6 @@ pub enum nsCSSPropertyID { eCSSProperty_b = 1, eCSSPropertyAlias_aa = 2, eCSSPropertyAlias_bb = 3, - #[doc = "< <div rustbindgen constant></div>"] + /// < <div rustbindgen constant></div> eCSSProperty_COUNT_unexistingVariantValue = 4, } diff --git a/tests/expectations/tests/contains-vs-inherits-zero-sized.rs b/tests/expectations/tests/contains-vs-inherits-zero-sized.rs index 7f30a3b1..9036b12f 100644 --- a/tests/expectations/tests/contains-vs-inherits-zero-sized.rs +++ b/tests/expectations/tests/contains-vs-inherits-zero-sized.rs @@ -7,7 +7,7 @@ non_upper_case_globals )] -#[doc = " This should get an `_address` byte."] +/// This should get an `_address` byte. #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Empty { @@ -26,8 +26,8 @@ fn bindgen_test_layout_Empty() { concat!("Alignment of ", stringify!(Empty)) ); } -#[doc = " This should not get an `_address` byte, so `sizeof(Inherits)` should be"] -#[doc = " `1`."] +/// This should not get an `_address` byte, so `sizeof(Inherits)` should be +/// `1`. #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Inherits { @@ -56,8 +56,8 @@ fn bindgen_test_layout_Inherits() { ) ); } -#[doc = " This should not get an `_address` byte, but contains `Empty` which *does* get"] -#[doc = " one, so `sizeof(Contains)` should be `1 + 1`."] +/// This should not get an `_address` byte, but contains `Empty` which *does* get +/// one, so `sizeof(Contains)` should be `1 + 1`. #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Contains { diff --git a/tests/expectations/tests/convert-cpp-comment-to-rust.rs b/tests/expectations/tests/convert-cpp-comment-to-rust.rs index 6781cd1e..dfc3104b 100644 --- a/tests/expectations/tests/convert-cpp-comment-to-rust.rs +++ b/tests/expectations/tests/convert-cpp-comment-to-rust.rs @@ -8,15 +8,15 @@ )] pub type mbedtls_mpi_uint = ::std::os::raw::c_uint; -#[doc = " \\brief MPI structure"] +/// \brief MPI structure #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct mbedtls_mpi { - #[doc = "< integer sign"] + /// < integer sign pub s: ::std::os::raw::c_int, - #[doc = "< total # of limbs"] + /// < total # of limbs pub n: ::std::os::raw::c_ulong, - #[doc = "< pointer to limbs"] + /// < pointer to limbs pub p: *mut mbedtls_mpi_uint, } #[test] diff --git a/tests/expectations/tests/derive-bitfield-method-same-name.rs b/tests/expectations/tests/derive-bitfield-method-same-name.rs index e8b33a81..70ee2973 100644 --- a/tests/expectations/tests/derive-bitfield-method-same-name.rs +++ b/tests/expectations/tests/derive-bitfield-method-same-name.rs @@ -89,9 +89,9 @@ where } } } -#[doc = " Because this struct have array larger than 32 items"] -#[doc = " and --with-derive-partialeq --impl-partialeq --impl-debug is provided,"] -#[doc = " this struct should manually implement `Debug` and `PartialEq`."] +/// Because this struct have array larger than 32 items +/// and --with-derive-partialeq --impl-partialeq --impl-debug is provided, +/// this struct should manually implement `Debug` and `PartialEq`. #[repr(C)] #[derive(Copy, Clone)] pub struct Foo { diff --git a/tests/expectations/tests/derive-clone.rs b/tests/expectations/tests/derive-clone.rs index 80dee43d..62042ffc 100644 --- a/tests/expectations/tests/derive-clone.rs +++ b/tests/expectations/tests/derive-clone.rs @@ -7,7 +7,7 @@ non_upper_case_globals )] -#[doc = " This struct should derive `Clone`."] +/// This struct should derive `Clone`. #[repr(C)] #[derive(Copy, Clone)] pub struct ShouldDeriveClone { diff --git a/tests/expectations/tests/derive-clone_1_0.rs b/tests/expectations/tests/derive-clone_1_0.rs index b56ded1d..c2fafe8f 100644 --- a/tests/expectations/tests/derive-clone_1_0.rs +++ b/tests/expectations/tests/derive-clone_1_0.rs @@ -7,8 +7,8 @@ non_upper_case_globals )] -#[doc = " Since builtin `Clone` impls were introduced in Rust 1.21 this struct"] -#[doc = " should impl `Clone` \"manually\"."] +/// Since builtin `Clone` impls were introduced in Rust 1.21 this struct +/// should impl `Clone` "manually". #[repr(C)] #[derive(Copy)] pub struct ShouldImplClone { diff --git a/tests/expectations/tests/derive-default-and-blacklist.rs b/tests/expectations/tests/derive-default-and-blacklist.rs index 292e51b0..1520aa3c 100644 --- a/tests/expectations/tests/derive-default-and-blacklist.rs +++ b/tests/expectations/tests/derive-default-and-blacklist.rs @@ -9,8 +9,8 @@ pub struct BlacklistMe(u8); -#[doc = " Because this type contains a blacklisted type, it should not derive"] -#[doc = " Default. Instead, we should emit a `mem::zeroed` implementation."] +/// Because this type contains a blacklisted type, it should not derive +/// Default. Instead, we should emit a `mem::zeroed` implementation. #[repr(C)] pub struct ShouldNotDeriveDefault { pub a: BlacklistMe, diff --git a/tests/expectations/tests/derive-hash-and-blacklist.rs b/tests/expectations/tests/derive-hash-and-blacklist.rs index 8e58055b..92e918ca 100644 --- a/tests/expectations/tests/derive-hash-and-blacklist.rs +++ b/tests/expectations/tests/derive-hash-and-blacklist.rs @@ -9,7 +9,7 @@ pub struct BlacklistMe(u8); -#[doc = " Because this type contains a blacklisted type, it should not derive Hash."] +/// Because this type contains a blacklisted type, it should not derive Hash. #[repr(C)] pub struct ShouldNotDeriveHash { pub a: BlacklistMe, diff --git a/tests/expectations/tests/derive-hash-blacklisting.rs b/tests/expectations/tests/derive-hash-blacklisting.rs index 2bbc4a16..f64db062 100644 --- a/tests/expectations/tests/derive-hash-blacklisting.rs +++ b/tests/expectations/tests/derive-hash-blacklisting.rs @@ -14,8 +14,8 @@ pub struct Blacklisted<T> { pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, } -#[doc = " This would derive(Hash, Eq, PartialEq) if it didn\'t contain a blacklisted type,"] -#[doc = " causing us to conservatively avoid deriving hash/Eq/PartialEq for it."] +/// This would derive(Hash, Eq, PartialEq) if it didn't contain a blacklisted type, +/// causing us to conservatively avoid deriving hash/Eq/PartialEq for it. #[repr(C)] pub struct WhitelistedOne { pub a: Blacklisted<::std::os::raw::c_int>, @@ -48,7 +48,7 @@ impl Default for WhitelistedOne { unsafe { ::std::mem::zeroed() } } } -#[doc = " This can\'t derive(Hash/Eq) even if it didn\'t contain a blacklisted type."] +/// This can't derive(Hash/Eq) even if it didn't contain a blacklisted type. #[repr(C)] pub struct WhitelistedTwo { pub b: Blacklisted<f32>, diff --git a/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs b/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs index bd0acb04..c3159532 100644 --- a/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs +++ b/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs @@ -7,7 +7,7 @@ non_upper_case_globals )] -#[doc = " A struct containing a struct containing a float that cannot derive Hash/Eq/Ord but can derive PartialEq/PartialOrd"] +/// A struct containing a struct containing a float that cannot derive Hash/Eq/Ord but can derive PartialEq/PartialOrd #[repr(C)] #[derive(Debug, Default, Copy, Clone, PartialOrd, PartialEq)] pub struct foo { diff --git a/tests/expectations/tests/derive-hash-struct-with-float-array.rs b/tests/expectations/tests/derive-hash-struct-with-float-array.rs index e2d05e0b..9ff64fde 100644 --- a/tests/expectations/tests/derive-hash-struct-with-float-array.rs +++ b/tests/expectations/tests/derive-hash-struct-with-float-array.rs @@ -7,7 +7,7 @@ non_upper_case_globals )] -#[doc = " A struct containing an array of floats that cannot derive Hash/Eq/Ord but can derive PartialEq/PartialOrd"] +/// A struct containing an array of floats that cannot derive Hash/Eq/Ord but can derive PartialEq/PartialOrd #[repr(C)] #[derive(Debug, Default, Copy, Clone, PartialOrd, PartialEq)] pub struct foo { diff --git a/tests/expectations/tests/derive-hash-struct-with-pointer.rs b/tests/expectations/tests/derive-hash-struct-with-pointer.rs index 60f8ff46..c0b14b02 100644 --- a/tests/expectations/tests/derive-hash-struct-with-pointer.rs +++ b/tests/expectations/tests/derive-hash-struct-with-pointer.rs @@ -7,7 +7,7 @@ non_upper_case_globals )] -#[doc = " Pointers can derive Hash/PartialOrd/Ord/PartialEq/Eq"] +/// Pointers can derive Hash/PartialOrd/Ord/PartialEq/Eq #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] pub struct ConstPtrMutObj { diff --git a/tests/expectations/tests/derive-hash-template-def-float.rs b/tests/expectations/tests/derive-hash-template-def-float.rs index f2b338db..b4040802 100644 --- a/tests/expectations/tests/derive-hash-template-def-float.rs +++ b/tests/expectations/tests/derive-hash-template-def-float.rs @@ -7,7 +7,7 @@ non_upper_case_globals )] -#[doc = " Template definition containing a float, which cannot derive Hash/Eq/Ord but can derive PartialEq/PartialOrd."] +/// Template definition containing a float, which cannot derive Hash/Eq/Ord but can derive PartialEq/PartialOrd. #[repr(C)] #[derive(Debug, Copy, Clone, PartialOrd, PartialEq)] pub struct foo<T> { diff --git a/tests/expectations/tests/derive-hash-template-inst-float.rs b/tests/expectations/tests/derive-hash-template-inst-float.rs index 20f7c46c..ee9b3f4c 100644 --- a/tests/expectations/tests/derive-hash-template-inst-float.rs +++ b/tests/expectations/tests/derive-hash-template-inst-float.rs @@ -7,7 +7,7 @@ non_upper_case_globals )] -#[doc = " Template definition that doesn\'t contain float can derive Hash/PartialOrd/Ord/PartialEq/Eq"] +/// Template definition that doesn't contain float can derive Hash/PartialOrd/Ord/PartialEq/Eq #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] pub struct foo<T> { @@ -19,7 +19,7 @@ impl<T> Default for foo<T> { unsafe { ::std::mem::zeroed() } } } -#[doc = " Can derive Hash/PartialOrd/Ord/PartialEq/Eq when instantiated with int"] +/// Can derive Hash/PartialOrd/Ord/PartialEq/Eq when instantiated with int #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] pub struct IntStr { @@ -48,7 +48,7 @@ impl Default for IntStr { unsafe { ::std::mem::zeroed() } } } -#[doc = " Cannot derive Hash/Eq/Ord when instantiated with float but can derive PartialEq/PartialOrd"] +/// Cannot derive Hash/Eq/Ord when instantiated with float but can derive PartialEq/PartialOrd #[repr(C)] #[derive(Debug, Copy, Clone, PartialOrd, PartialEq)] pub struct FloatStr { diff --git a/tests/expectations/tests/derive-partialeq-and-blacklist.rs b/tests/expectations/tests/derive-partialeq-and-blacklist.rs index 42ae1464..01fdc079 100644 --- a/tests/expectations/tests/derive-partialeq-and-blacklist.rs +++ b/tests/expectations/tests/derive-partialeq-and-blacklist.rs @@ -9,8 +9,8 @@ pub struct BlacklistMe(u8); -#[doc = " Because this type contains a blacklisted type, it should not derive"] -#[doc = " PartialEq."] +/// Because this type contains a blacklisted type, it should not derive +/// PartialEq. #[repr(C)] pub struct ShouldNotDerivePartialEq { pub a: BlacklistMe, diff --git a/tests/expectations/tests/derive-partialeq-union.rs b/tests/expectations/tests/derive-partialeq-union.rs index e8fd542f..a271f410 100644 --- a/tests/expectations/tests/derive-partialeq-union.rs +++ b/tests/expectations/tests/derive-partialeq-union.rs @@ -7,7 +7,7 @@ non_upper_case_globals )] -#[doc = " Deriving PartialEq for rust unions is not supported."] +/// Deriving PartialEq for rust unions is not supported. #[repr(C)] #[derive(Copy, Clone)] pub union ShouldNotDerivePartialEq { diff --git a/tests/expectations/tests/derive-partialeq-union_1_0.rs b/tests/expectations/tests/derive-partialeq-union_1_0.rs index 83fd8333..41a42dd7 100644 --- a/tests/expectations/tests/derive-partialeq-union_1_0.rs +++ b/tests/expectations/tests/derive-partialeq-union_1_0.rs @@ -50,7 +50,7 @@ impl<T> ::std::cmp::PartialEq for __BindgenUnionField<T> { } } impl<T> ::std::cmp::Eq for __BindgenUnionField<T> {} -#[doc = " This should manually derive PartialEq."] +/// This should manually derive PartialEq. #[repr(C)] #[derive(Copy)] pub struct ShouldDerivePartialEq { diff --git a/tests/expectations/tests/doggo-or-null.rs b/tests/expectations/tests/doggo-or-null.rs index 0b84b456..5a7aa86f 100644 --- a/tests/expectations/tests/doggo-or-null.rs +++ b/tests/expectations/tests/doggo-or-null.rs @@ -48,12 +48,12 @@ fn bindgen_test_layout_Null() { concat!("Alignment of ", stringify!(Null)) ); } -#[doc = " This type is an opaque union. Unions can\'t derive anything interesting like"] -#[doc = " Debug or Default, even if their layout can, because it would require knowing"] -#[doc = " which variant is in use. Opaque unions still end up as a `union` in the Rust"] -#[doc = " bindings, but they just have one variant. Even so, can\'t derive. We should"] -#[doc = " probably emit an opaque struct for opaque unions... but until then, we have"] -#[doc = " this test to make sure that opaque unions don\'t derive and still compile."] +/// This type is an opaque union. Unions can't derive anything interesting like +/// Debug or Default, even if their layout can, because it would require knowing +/// which variant is in use. Opaque unions still end up as a `union` in the Rust +/// bindings, but they just have one variant. Even so, can't derive. We should +/// probably emit an opaque struct for opaque unions... but until then, we have +/// this test to make sure that opaque unions don't derive and still compile. #[repr(C)] #[derive(Copy, Clone)] pub union DoggoOrNull { diff --git a/tests/expectations/tests/enum-doc-bitfield.rs b/tests/expectations/tests/enum-doc-bitfield.rs index 7b11d0c6..caa604e4 100644 --- a/tests/expectations/tests/enum-doc-bitfield.rs +++ b/tests/expectations/tests/enum-doc-bitfield.rs @@ -8,30 +8,30 @@ )] impl B { - #[doc = " Document field with three slashes"] + /// Document field with three slashes pub const VAR_A: B = B(0); } impl B { - #[doc = " Document field with preceeding star"] + /// Document field with preceeding star pub const VAR_B: B = B(1); } impl B { - #[doc = " Document field with preceeding exclamation"] + /// Document field with preceeding exclamation pub const VAR_C: B = B(2); } impl B { - #[doc = "< Document field with following star"] + /// < Document field with following star pub const VAR_D: B = B(3); } impl B { - #[doc = "< Document field with following exclamation"] + /// < Document field with following exclamation pub const VAR_E: B = B(4); } impl B { - #[doc = " Document field with preceeding star, with a loong long multiline"] - #[doc = " comment."] - #[doc = ""] - #[doc = " Very interesting documentation, definitely."] + /// Document field with preceeding star, with a loong long multiline + /// comment. + /// + /// Very interesting documentation, definitely. pub const VAR_F: B = B(5); } impl ::std::ops::BitOr<B> for B { @@ -61,6 +61,6 @@ impl ::std::ops::BitAndAssign for B { } } #[repr(C)] -#[doc = " Document enum"] +/// Document enum #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub struct B(pub u32); diff --git a/tests/expectations/tests/enum-doc-mod.rs b/tests/expectations/tests/enum-doc-mod.rs index 35d671b0..18b27c80 100644 --- a/tests/expectations/tests/enum-doc-mod.rs +++ b/tests/expectations/tests/enum-doc-mod.rs @@ -8,21 +8,21 @@ )] pub mod B { - #[doc = " Document enum"] + /// Document enum pub type Type = u32; - #[doc = " Document field with three slashes"] + /// Document field with three slashes pub const VAR_A: Type = 0; - #[doc = " Document field with preceeding star"] + /// Document field with preceeding star pub const VAR_B: Type = 1; - #[doc = " Document field with preceeding exclamation"] + /// Document field with preceeding exclamation pub const VAR_C: Type = 2; - #[doc = "< Document field with following star"] + /// < Document field with following star pub const VAR_D: Type = 3; - #[doc = "< Document field with following exclamation"] + /// < Document field with following exclamation pub const VAR_E: Type = 4; - #[doc = " Document field with preceeding star, with a loong long multiline"] - #[doc = " comment."] - #[doc = ""] - #[doc = " Very interesting documentation, definitely."] + /// Document field with preceeding star, with a loong long multiline + /// comment. + /// + /// Very interesting documentation, definitely. pub const VAR_F: Type = 5; } diff --git a/tests/expectations/tests/enum-doc-rusty.rs b/tests/expectations/tests/enum-doc-rusty.rs index 8104a45a..a154f103 100644 --- a/tests/expectations/tests/enum-doc-rusty.rs +++ b/tests/expectations/tests/enum-doc-rusty.rs @@ -8,22 +8,22 @@ )] #[repr(u32)] -#[doc = " Document enum"] +/// Document enum #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum B { - #[doc = " Document field with three slashes"] + /// Document field with three slashes VAR_A = 0, - #[doc = " Document field with preceeding star"] + /// Document field with preceeding star VAR_B = 1, - #[doc = " Document field with preceeding exclamation"] + /// Document field with preceeding exclamation VAR_C = 2, - #[doc = "< Document field with following star"] + /// < Document field with following star VAR_D = 3, - #[doc = "< Document field with following exclamation"] + /// < Document field with following exclamation VAR_E = 4, - #[doc = " Document field with preceeding star, with a loong long multiline"] - #[doc = " comment."] - #[doc = ""] - #[doc = " Very interesting documentation, definitely."] + /// Document field with preceeding star, with a loong long multiline + /// comment. + /// + /// Very interesting documentation, definitely. VAR_F = 5, } diff --git a/tests/expectations/tests/enum-doc.rs b/tests/expectations/tests/enum-doc.rs index 4221ca80..9cde2974 100644 --- a/tests/expectations/tests/enum-doc.rs +++ b/tests/expectations/tests/enum-doc.rs @@ -7,20 +7,20 @@ non_upper_case_globals )] -#[doc = " Document field with three slashes"] +/// Document field with three slashes pub const B_VAR_A: B = 0; -#[doc = " Document field with preceeding star"] +/// Document field with preceeding star pub const B_VAR_B: B = 1; -#[doc = " Document field with preceeding exclamation"] +/// Document field with preceeding exclamation pub const B_VAR_C: B = 2; -#[doc = "< Document field with following star"] +/// < Document field with following star pub const B_VAR_D: B = 3; -#[doc = "< Document field with following exclamation"] +/// < Document field with following exclamation pub const B_VAR_E: B = 4; -#[doc = " Document field with preceeding star, with a loong long multiline"] -#[doc = " comment."] -#[doc = ""] -#[doc = " Very interesting documentation, definitely."] +/// Document field with preceeding star, with a loong long multiline +/// comment. +/// +/// Very interesting documentation, definitely. pub const B_VAR_F: B = 5; -#[doc = " Document enum"] +/// Document enum pub type B = u32; diff --git a/tests/expectations/tests/enum-variant-replaces.rs b/tests/expectations/tests/enum-variant-replaces.rs index 9cb48f85..d710e100 100644 --- a/tests/expectations/tests/enum-variant-replaces.rs +++ b/tests/expectations/tests/enum-variant-replaces.rs @@ -7,13 +7,13 @@ non_upper_case_globals )] -#[doc = " <div rustbindgen replaces=\"PASS\"></div>"] -#[doc = ""] -#[doc = " Should see PASS below."] +/// <div rustbindgen replaces="PASS"></div> +/// +/// Should see PASS below. pub const OGRErr_PASS: OGRErr = 0; -#[doc = " <div rustbindgen replaces=\"OGRERR_NONE\"></div>"] -#[doc = ""] -#[doc = " Should see OGRERR_NONE instead of CUSTOM_OGRERR_NONE below."] +/// <div rustbindgen replaces="OGRERR_NONE"></div> +/// +/// Should see OGRERR_NONE instead of CUSTOM_OGRERR_NONE below. pub const OGRErr_OGRERR_NONE: OGRErr = 1; -#[doc = " <div rustbindgen replaces=\"OGRErr\"></div>"] +/// <div rustbindgen replaces="OGRErr"></div> pub type OGRErr = u32; diff --git a/tests/expectations/tests/inherit-from-template-instantiation-with-vtable.rs b/tests/expectations/tests/inherit-from-template-instantiation-with-vtable.rs index 9be33800..19200ac1 100644 --- a/tests/expectations/tests/inherit-from-template-instantiation-with-vtable.rs +++ b/tests/expectations/tests/inherit-from-template-instantiation-with-vtable.rs @@ -9,7 +9,7 @@ #[repr(C)] pub struct BaseWithVtable__bindgen_vtable(::std::os::raw::c_void); -#[doc = " This should have an explicit vtable."] +/// This should have an explicit vtable. #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct BaseWithVtable<T> { @@ -22,7 +22,7 @@ impl<T> Default for BaseWithVtable<T> { unsafe { ::std::mem::zeroed() } } } -#[doc = " This should not have an explicit vtable."] +/// This should not have an explicit vtable. #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct DerivedWithNoVirtualMethods { @@ -46,7 +46,7 @@ impl Default for DerivedWithNoVirtualMethods { unsafe { ::std::mem::zeroed() } } } -#[doc = " This should not have an explicit vtable."] +/// This should not have an explicit vtable. #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct DerivedWithVirtualMethods { @@ -70,7 +70,7 @@ impl Default for DerivedWithVirtualMethods { unsafe { ::std::mem::zeroed() } } } -#[doc = " This should not have any vtable."] +/// This should not have any vtable. #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct BaseWithoutVtable<U> { @@ -84,7 +84,7 @@ impl<U> Default for BaseWithoutVtable<U> { } #[repr(C)] pub struct DerivedWithVtable__bindgen_vtable(::std::os::raw::c_void); -#[doc = " This should have an explicit vtable."] +/// This should have an explicit vtable. #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct DerivedWithVtable { @@ -109,7 +109,7 @@ impl Default for DerivedWithVtable { unsafe { ::std::mem::zeroed() } } } -#[doc = " This should not have any vtable."] +/// This should not have any vtable. #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct DerivedWithoutVtable { diff --git a/tests/expectations/tests/issue-537.rs b/tests/expectations/tests/issue-537.rs index 98bc0a96..8913db36 100644 --- a/tests/expectations/tests/issue-537.rs +++ b/tests/expectations/tests/issue-537.rs @@ -7,8 +7,8 @@ non_upper_case_globals )] -#[doc = " This should not be opaque; we can see the attributes and can pack the"] -#[doc = " struct."] +/// This should not be opaque; we can see the attributes and can pack the +/// struct. #[repr(C, packed)] #[derive(Debug, Default, Copy, Clone)] pub struct AlignedToOne { @@ -37,8 +37,8 @@ fn bindgen_test_layout_AlignedToOne() { ) ); } -#[doc = " This should be opaque because although we can see the attributes, Rust"] -#[doc = " doesn\'t have `#[repr(packed = \"N\")]` yet."] +/// This should be opaque because although we can see the attributes, Rust +/// doesn't have `#[repr(packed = "N")]` yet. #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct AlignedToTwo { @@ -57,9 +57,9 @@ fn bindgen_test_layout_AlignedToTwo() { concat!("Alignment of ", stringify!(AlignedToTwo)) ); } -#[doc = " This should not be opaque because although `libclang` doesn\'t give us the"] -#[doc = " `#pragma pack(1)`, we can detect that alignment is 1 and add"] -#[doc = " `#[repr(packed)]` to the struct ourselves."] +/// This should not be opaque because although `libclang` doesn't give us the +/// `#pragma pack(1)`, we can detect that alignment is 1 and add +/// `#[repr(packed)]` to the struct ourselves. #[repr(C, packed)] #[derive(Debug, Default, Copy, Clone)] pub struct PackedToOne { @@ -99,9 +99,9 @@ fn bindgen_test_layout_PackedToOne() { ) ); } -#[doc = " In this case, even if we can detect the weird alignment triggered by"] -#[doc = " `#pragma pack(2)`, we can\'t do anything about it because Rust doesn\'t have"] -#[doc = " `#[repr(packed = \"N\")]`. Therefore, we must make it opaque."] +/// In this case, even if we can detect the weird alignment triggered by +/// `#pragma pack(2)`, we can't do anything about it because Rust doesn't have +/// `#[repr(packed = "N")]`. Therefore, we must make it opaque. #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct PackedToTwo { diff --git a/tests/expectations/tests/issue-648-derive-debug-with-padding.rs b/tests/expectations/tests/issue-648-derive-debug-with-padding.rs index 6df8e4b5..ddd85455 100644 --- a/tests/expectations/tests/issue-648-derive-debug-with-padding.rs +++ b/tests/expectations/tests/issue-648-derive-debug-with-padding.rs @@ -7,10 +7,10 @@ non_upper_case_globals )] -#[doc = " We emit a `[u8; 63usize]` padding field for this struct, which cannot derive"] -#[doc = " Debug/Hash because 63 is over the hard coded limit. (Yes, this struct doesn\'t end"] -#[doc = " up with the reight alignment, we\'re waiting on `#[repr(align=\"N\")]` to land"] -#[doc = " in rustc)."] +/// We emit a `[u8; 63usize]` padding field for this struct, which cannot derive +/// Debug/Hash because 63 is over the hard coded limit. (Yes, this struct doesn't end +/// up with the reight alignment, we're waiting on `#[repr(align="N")]` to land +/// in rustc). #[repr(C)] #[derive(Copy, Clone)] pub struct NoDebug { @@ -45,10 +45,10 @@ impl ::std::cmp::PartialEq for NoDebug { self.c == other.c } } -#[doc = " This should derive Debug/Hash/PartialEq/Eq because the padding size is less than the max derive"] -#[doc = " Debug/Hash/PartialEq/Eq impl for arrays. However, we conservatively don\'t derive Debug/Hash because"] -#[doc = " we determine Debug derive-ability before we compute padding, which happens at"] -#[doc = " codegen. (Again, we expect to get the alignment wrong for similar reasons.)"] +/// This should derive Debug/Hash/PartialEq/Eq because the padding size is less than the max derive +/// Debug/Hash/PartialEq/Eq impl for arrays. However, we conservatively don't derive Debug/Hash because +/// we determine Debug derive-ability before we compute padding, which happens at +/// codegen. (Again, we expect to get the alignment wrong for similar reasons.) #[repr(C)] #[derive(Copy, Clone)] pub struct ShouldDeriveDebugButDoesNot { diff --git a/tests/expectations/tests/issue-848-replacement-system-include.rs b/tests/expectations/tests/issue-848-replacement-system-include.rs index 4e6efd6b..6e20983f 100644 --- a/tests/expectations/tests/issue-848-replacement-system-include.rs +++ b/tests/expectations/tests/issue-848-replacement-system-include.rs @@ -7,12 +7,12 @@ non_upper_case_globals )] -#[doc = " This is intended to replace another type, but won\'t if we treat this include"] -#[doc = " as a system include, because clang doesn\'t parse comments there."] -#[doc = ""] -#[doc = " See #848."] -#[doc = ""] -#[doc = " <div rustbindgen replaces=\"nsTArray\"></div>"] +/// This is intended to replace another type, but won't if we treat this include +/// as a system include, because clang doesn't parse comments there. +/// +/// See #848. +/// +/// <div rustbindgen replaces="nsTArray"></div> #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct nsTArray<T> { diff --git a/tests/expectations/tests/issue-944-derive-copy-and-blacklisting.rs b/tests/expectations/tests/issue-944-derive-copy-and-blacklisting.rs index 2570316b..5ca34ebb 100644 --- a/tests/expectations/tests/issue-944-derive-copy-and-blacklisting.rs +++ b/tests/expectations/tests/issue-944-derive-copy-and-blacklisting.rs @@ -1,10 +1,15 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub struct BlacklistMe(u8); -#[doc = " Because this type contains a blacklisted type, it should not derive Copy."] +/// Because this type contains a blacklisted type, it should not derive Copy. #[repr(C)] pub struct ShouldNotBeCopy { pub a: BlacklistMe, diff --git a/tests/expectations/tests/issue_315.rs b/tests/expectations/tests/issue_315.rs index 983452de..1eb30119 100644 --- a/tests/expectations/tests/issue_315.rs +++ b/tests/expectations/tests/issue_315.rs @@ -7,5 +7,5 @@ non_upper_case_globals )] -#[doc = " <div rustbindgen replaces=\"c\"></div>"] +/// <div rustbindgen replaces="c"></div> pub type c<a> = a; diff --git a/tests/expectations/tests/jsval_layout_opaque.rs b/tests/expectations/tests/jsval_layout_opaque.rs index 3c2a0cbe..00b4301c 100644 --- a/tests/expectations/tests/jsval_layout_opaque.rs +++ b/tests/expectations/tests/jsval_layout_opaque.rs @@ -136,43 +136,43 @@ pub enum JSValueShiftedTag { #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum JSWhyMagic { - #[doc = " a hole in a native object\'s elements"] + /// a hole in a native object's elements JS_ELEMENTS_HOLE = 0, - #[doc = " there is not a pending iterator value"] + /// there is not a pending iterator value JS_NO_ITER_VALUE = 1, - #[doc = " exception value thrown when closing a generator"] + /// exception value thrown when closing a generator JS_GENERATOR_CLOSING = 2, - #[doc = " compiler sentinel value"] + /// compiler sentinel value JS_NO_CONSTANT = 3, - #[doc = " used in debug builds to catch tracing errors"] + /// used in debug builds to catch tracing errors JS_THIS_POISON = 4, - #[doc = " used in debug builds to catch tracing errors"] + /// used in debug builds to catch tracing errors JS_ARG_POISON = 5, - #[doc = " an empty subnode in the AST serializer"] + /// an empty subnode in the AST serializer JS_SERIALIZE_NO_NODE = 6, - #[doc = " lazy arguments value on the stack"] + /// lazy arguments value on the stack JS_LAZY_ARGUMENTS = 7, - #[doc = " optimized-away \'arguments\' value"] + /// optimized-away 'arguments' value JS_OPTIMIZED_ARGUMENTS = 8, - #[doc = " magic value passed to natives to indicate construction"] + /// magic value passed to natives to indicate construction JS_IS_CONSTRUCTING = 9, - #[doc = " arguments.callee has been overwritten"] + /// arguments.callee has been overwritten JS_OVERWRITTEN_CALLEE = 10, - #[doc = " value of static block object slot"] + /// value of static block object slot JS_BLOCK_NEEDS_CLONE = 11, - #[doc = " see class js::HashableValue"] + /// see class js::HashableValue JS_HASH_KEY_EMPTY = 12, - #[doc = " error while running Ion code"] + /// error while running Ion code JS_ION_ERROR = 13, - #[doc = " missing recover instruction result"] + /// missing recover instruction result JS_ION_BAILOUT = 14, - #[doc = " optimized out slot"] + /// optimized out slot JS_OPTIMIZED_OUT = 15, - #[doc = " uninitialized lexical bindings that produce ReferenceError on touch."] + /// uninitialized lexical bindings that produce ReferenceError on touch. JS_UNINITIALIZED_LEXICAL = 16, - #[doc = " for local use"] + /// for local use JS_GENERIC_MAGIC = 17, - #[doc = " for local use"] + /// for local use JS_WHY_MAGIC_COUNT = 18, } #[repr(C)] diff --git a/tests/expectations/tests/jsval_layout_opaque_1_0.rs b/tests/expectations/tests/jsval_layout_opaque_1_0.rs index 539465c3..7bd58819 100644 --- a/tests/expectations/tests/jsval_layout_opaque_1_0.rs +++ b/tests/expectations/tests/jsval_layout_opaque_1_0.rs @@ -179,43 +179,43 @@ pub enum JSValueShiftedTag { #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum JSWhyMagic { - #[doc = " a hole in a native object\'s elements"] + /// a hole in a native object's elements JS_ELEMENTS_HOLE = 0, - #[doc = " there is not a pending iterator value"] + /// there is not a pending iterator value JS_NO_ITER_VALUE = 1, - #[doc = " exception value thrown when closing a generator"] + /// exception value thrown when closing a generator JS_GENERATOR_CLOSING = 2, - #[doc = " compiler sentinel value"] + /// compiler sentinel value JS_NO_CONSTANT = 3, - #[doc = " used in debug builds to catch tracing errors"] + /// used in debug builds to catch tracing errors JS_THIS_POISON = 4, - #[doc = " used in debug builds to catch tracing errors"] + /// used in debug builds to catch tracing errors JS_ARG_POISON = 5, - #[doc = " an empty subnode in the AST serializer"] + /// an empty subnode in the AST serializer JS_SERIALIZE_NO_NODE = 6, - #[doc = " lazy arguments value on the stack"] + /// lazy arguments value on the stack JS_LAZY_ARGUMENTS = 7, - #[doc = " optimized-away \'arguments\' value"] + /// optimized-away 'arguments' value JS_OPTIMIZED_ARGUMENTS = 8, - #[doc = " magic value passed to natives to indicate construction"] + /// magic value passed to natives to indicate construction JS_IS_CONSTRUCTING = 9, - #[doc = " arguments.callee has been overwritten"] + /// arguments.callee has been overwritten JS_OVERWRITTEN_CALLEE = 10, - #[doc = " value of static block object slot"] + /// value of static block object slot JS_BLOCK_NEEDS_CLONE = 11, - #[doc = " see class js::HashableValue"] + /// see class js::HashableValue JS_HASH_KEY_EMPTY = 12, - #[doc = " error while running Ion code"] + /// error while running Ion code JS_ION_ERROR = 13, - #[doc = " missing recover instruction result"] + /// missing recover instruction result JS_ION_BAILOUT = 14, - #[doc = " optimized out slot"] + /// optimized out slot JS_OPTIMIZED_OUT = 15, - #[doc = " uninitialized lexical bindings that produce ReferenceError on touch."] + /// uninitialized lexical bindings that produce ReferenceError on touch. JS_UNINITIALIZED_LEXICAL = 16, - #[doc = " for local use"] + /// for local use JS_GENERIC_MAGIC = 17, - #[doc = " for local use"] + /// for local use JS_WHY_MAGIC_COUNT = 18, } #[repr(C)] diff --git a/tests/expectations/tests/layout_align.rs b/tests/expectations/tests/layout_align.rs index 0979da1e..b994080b 100644 --- a/tests/expectations/tests/layout_align.rs +++ b/tests/expectations/tests/layout_align.rs @@ -129,15 +129,15 @@ impl<T> ::std::marker::Copy for __IncompleteArrayField<T> {} #[repr(C)] #[derive(Debug)] pub struct rte_kni_fifo { - #[doc = "< Next position to be written"] + /// < Next position to be written pub write: ::std::os::raw::c_uint, - #[doc = "< Next position to be read"] + /// < Next position to be read pub read: ::std::os::raw::c_uint, - #[doc = "< Circular buffer length"] + /// < Circular buffer length pub len: ::std::os::raw::c_uint, - #[doc = "< Pointer size - for 32/64 bit OS"] + /// < Pointer size - for 32/64 bit OS pub elem_size: ::std::os::raw::c_uint, - #[doc = "< The buffer contains mbuf pointers"] + /// < The buffer contains mbuf pointers pub buffer: __IncompleteArrayField<*mut ::std::os::raw::c_void>, pub __bindgen_align: [u64; 0usize], } @@ -162,7 +162,7 @@ impl Default for rte_kni_fifo { #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct rte_eth_link { - #[doc = "< ETH_SPEED_NUM_"] + /// < ETH_SPEED_NUM_ pub link_speed: u32, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, pub __bindgen_padding_0: [u8; 3usize], diff --git a/tests/expectations/tests/layout_arp.rs b/tests/expectations/tests/layout_arp.rs index 9738393b..ad1762c0 100644 --- a/tests/expectations/tests/layout_arp.rs +++ b/tests/expectations/tests/layout_arp.rs @@ -15,19 +15,19 @@ pub const ARP_OP_REVREQUEST: u32 = 3; pub const ARP_OP_REVREPLY: u32 = 4; pub const ARP_OP_INVREQUEST: u32 = 8; pub const ARP_OP_INVREPLY: u32 = 9; -#[doc = " Ethernet address:"] -#[doc = " A universally administered address is uniquely assigned to a device by its"] -#[doc = " manufacturer. The first three octets (in transmission order) contain the"] -#[doc = " Organizationally Unique Identifier (OUI). The following three (MAC-48 and"] -#[doc = " EUI-48) octets are assigned by that organization with the only constraint"] -#[doc = " of uniqueness."] -#[doc = " A locally administered address is assigned to a device by a network"] -#[doc = " administrator and does not contain OUIs."] -#[doc = " See http://standards.ieee.org/regauth/groupmac/tutorial.html"] +/// Ethernet address: +/// A universally administered address is uniquely assigned to a device by its +/// manufacturer. The first three octets (in transmission order) contain the +/// Organizationally Unique Identifier (OUI). The following three (MAC-48 and +/// EUI-48) octets are assigned by that organization with the only constraint +/// of uniqueness. +/// A locally administered address is assigned to a device by a network +/// administrator and does not contain OUIs. +/// See http://standards.ieee.org/regauth/groupmac/tutorial.html #[repr(C, packed)] #[derive(Debug, Default, Copy, Clone)] pub struct ether_addr { - #[doc = "< Addr bytes in tx order"] + /// < Addr bytes in tx order pub addr_bytes: [u8; 6usize], } #[test] @@ -53,17 +53,17 @@ fn bindgen_test_layout_ether_addr() { ) ); } -#[doc = " ARP header IPv4 payload."] +/// ARP header IPv4 payload. #[repr(C, packed)] #[derive(Debug, Default, Copy, Clone)] pub struct arp_ipv4 { - #[doc = "< sender hardware address"] + /// < sender hardware address pub arp_sha: ether_addr, - #[doc = "< sender IP address"] + /// < sender IP address pub arp_sip: u32, - #[doc = "< target hardware address"] + /// < target hardware address pub arp_tha: ether_addr, - #[doc = "< target IP address"] + /// < target IP address pub arp_tip: u32, } #[test] @@ -119,7 +119,7 @@ fn bindgen_test_layout_arp_ipv4() { ) ); } -#[doc = " ARP header."] +/// ARP header. #[repr(C, packed)] #[derive(Debug, Default, Copy, Clone)] pub struct arp_hdr { diff --git a/tests/expectations/tests/layout_array.rs b/tests/expectations/tests/layout_array.rs index 34e976f4..db57e420 100644 --- a/tests/expectations/tests/layout_array.rs +++ b/tests/expectations/tests/layout_array.rs @@ -16,19 +16,19 @@ pub const RTE_HEAP_NUM_FREELISTS: u32 = 13; pub struct rte_mempool { _unused: [u8; 0], } -#[doc = " Prototype for implementation specific data provisioning function."] -#[doc = ""] -#[doc = " The function should provide the implementation specific memory for"] -#[doc = " for use by the other mempool ops functions in a given mempool ops struct."] -#[doc = " E.g. the default ops provides an instance of the rte_ring for this purpose."] -#[doc = " it will most likely point to a different type of data structure, and"] -#[doc = " will be transparent to the application programmer."] -#[doc = " This function should set mp->pool_data."] +/// Prototype for implementation specific data provisioning function. +/// +/// The function should provide the implementation specific memory for +/// for use by the other mempool ops functions in a given mempool ops struct. +/// E.g. the default ops provides an instance of the rte_ring for this purpose. +/// it will most likely point to a different type of data structure, and +/// will be transparent to the application programmer. +/// This function should set mp->pool_data. pub type rte_mempool_alloc_t = ::std::option::Option<unsafe extern "C" fn(mp: *mut rte_mempool) -> ::std::os::raw::c_int>; -#[doc = " Free the opaque private data pointed to by mp->pool_data pointer."] +/// Free the opaque private data pointed to by mp->pool_data pointer. pub type rte_mempool_free_t = ::std::option::Option<unsafe extern "C" fn(mp: *mut rte_mempool)>; -#[doc = " Enqueue an object into the external pool."] +/// Enqueue an object into the external pool. pub type rte_mempool_enqueue_t = ::std::option::Option< unsafe extern "C" fn( mp: *mut rte_mempool, @@ -36,7 +36,7 @@ pub type rte_mempool_enqueue_t = ::std::option::Option< n: ::std::os::raw::c_uint, ) -> ::std::os::raw::c_int, >; -#[doc = " Dequeue an object from the external pool."] +/// Dequeue an object from the external pool. pub type rte_mempool_dequeue_t = ::std::option::Option< unsafe extern "C" fn( mp: *mut rte_mempool, @@ -44,24 +44,24 @@ pub type rte_mempool_dequeue_t = ::std::option::Option< n: ::std::os::raw::c_uint, ) -> ::std::os::raw::c_int, >; -#[doc = " Return the number of available objects in the external pool."] +/// Return the number of available objects in the external pool. pub type rte_mempool_get_count = ::std::option::Option<unsafe extern "C" fn(mp: *const rte_mempool) -> ::std::os::raw::c_uint>; -#[doc = " Structure defining mempool operations structure"] +/// Structure defining mempool operations structure #[repr(C)] #[derive(Copy, Clone)] pub struct rte_mempool_ops { - #[doc = "< Name of mempool ops struct."] + /// < Name of mempool ops struct. pub name: [::std::os::raw::c_char; 32usize], - #[doc = "< Allocate private data."] + /// < Allocate private data. pub alloc: rte_mempool_alloc_t, - #[doc = "< Free the external pool."] + /// < Free the external pool. pub free: rte_mempool_free_t, - #[doc = "< Enqueue an object."] + /// < Enqueue an object. pub enqueue: rte_mempool_enqueue_t, - #[doc = "< Dequeue an object."] + /// < Dequeue an object. pub dequeue: rte_mempool_dequeue_t, - #[doc = "< Get qty of available objs."] + /// < Get qty of available objs. pub get_count: rte_mempool_get_count, pub __bindgen_padding_0: [u64; 7usize], } @@ -148,11 +148,11 @@ impl ::std::cmp::PartialEq for rte_mempool_ops { && self.get_count == other.get_count } } -#[doc = " The rte_spinlock_t type."] +/// The rte_spinlock_t type. #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct rte_spinlock_t { - #[doc = "< lock status 0 = unlocked, 1 = locked"] + /// < lock status 0 = unlocked, 1 = locked pub locked: ::std::os::raw::c_int, } #[test] @@ -178,22 +178,22 @@ fn bindgen_test_layout_rte_spinlock_t() { ) ); } -#[doc = " Structure storing the table of registered ops structs, each of which contain"] -#[doc = " the function pointers for the mempool ops functions."] -#[doc = " Each process has its own storage for this ops struct array so that"] -#[doc = " the mempools can be shared across primary and secondary processes."] -#[doc = " The indices used to access the array are valid across processes, whereas"] -#[doc = " any function pointers stored directly in the mempool struct would not be."] -#[doc = " This results in us simply having \"ops_index\" in the mempool struct."] +/// Structure storing the table of registered ops structs, each of which contain +/// the function pointers for the mempool ops functions. +/// Each process has its own storage for this ops struct array so that +/// the mempools can be shared across primary and secondary processes. +/// The indices used to access the array are valid across processes, whereas +/// any function pointers stored directly in the mempool struct would not be. +/// This results in us simply having "ops_index" in the mempool struct. #[repr(C)] #[derive(Copy, Clone)] pub struct rte_mempool_ops_table { - #[doc = "< Spinlock for add/delete."] + /// < Spinlock for add/delete. pub sl: rte_spinlock_t, - #[doc = "< Number of used ops structs in the table."] + /// < Number of used ops structs in the table. pub num_ops: u32, pub __bindgen_padding_0: [u64; 7usize], - #[doc = " Storage for all possible ops structs."] + /// Storage for all possible ops structs. pub ops: [rte_mempool_ops; 16usize], } #[test] @@ -239,7 +239,7 @@ impl Default for rte_mempool_ops_table { unsafe { ::std::mem::zeroed() } } } -#[doc = " Structure to hold malloc heap"] +/// Structure to hold malloc heap #[repr(C)] #[derive(Copy, Clone)] pub struct malloc_heap { diff --git a/tests/expectations/tests/layout_array_too_long.rs b/tests/expectations/tests/layout_array_too_long.rs index c53b028e..f6a497f2 100644 --- a/tests/expectations/tests/layout_array_too_long.rs +++ b/tests/expectations/tests/layout_array_too_long.rs @@ -16,23 +16,23 @@ pub const IP_MAX_FRAG_NUM: _bindgen_ty_1 = _bindgen_ty_1::IP_MAX_FRAG_NUM; #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum _bindgen_ty_1 { - #[doc = "< index of last fragment"] + /// < index of last fragment IP_LAST_FRAG_IDX = 0, - #[doc = "< index of first fragment"] + /// < index of first fragment IP_FIRST_FRAG_IDX = 1, - #[doc = "< minimum number of fragments"] + /// < minimum number of fragments IP_MIN_FRAG_NUM = 2, IP_MAX_FRAG_NUM = 4, } -#[doc = " @internal fragmented mbuf"] +/// @internal fragmented mbuf #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct ip_frag { - #[doc = "< offset into the packet"] + /// < offset into the packet pub ofs: u16, - #[doc = "< length of fragment"] + /// < length of fragment pub len: u16, - #[doc = "< fragment mbuf"] + /// < fragment mbuf pub mb: *mut rte_mbuf, } #[test] @@ -83,15 +83,15 @@ impl Default for ip_frag { unsafe { ::std::mem::zeroed() } } } -#[doc = " @internal <src addr, dst_addr, id> to uniquely indetify fragmented datagram."] +/// @internal <src addr, dst_addr, id> to uniquely indetify fragmented datagram. #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct ip_frag_key { - #[doc = "< src address, first 8 bytes used for IPv4"] + /// < src address, first 8 bytes used for IPv4 pub src_dst: [u64; 4usize], - #[doc = "< dst address"] + /// < dst address pub id: u32, - #[doc = "< src/dst key length"] + /// < src/dst key length pub key_len: u32, } #[test] @@ -137,24 +137,24 @@ fn bindgen_test_layout_ip_frag_key() { ) ); } -#[doc = " @internal Fragmented packet to reassemble."] -#[doc = " First two entries in the frags[] array are for the last and first fragments."] +/// @internal Fragmented packet to reassemble. +/// First two entries in the frags[] array are for the last and first fragments. #[repr(C)] #[derive(Copy, Clone)] pub struct ip_frag_pkt { - #[doc = "< LRU list"] + /// < LRU list pub lru: ip_frag_pkt__bindgen_ty_1, - #[doc = "< fragmentation key"] + /// < fragmentation key pub key: ip_frag_key, - #[doc = "< creation timestamp"] + /// < creation timestamp pub start: u64, - #[doc = "< expected reassembled size"] + /// < expected reassembled size pub total_size: u32, - #[doc = "< size of fragments received"] + /// < size of fragments received pub frag_size: u32, - #[doc = "< index of next entry to fill"] + /// < index of next entry to fill pub last_idx: u32, - #[doc = "< fragments"] + /// < fragments pub frags: [ip_frag; 4usize], pub __bindgen_padding_0: [u64; 6usize], } @@ -300,7 +300,7 @@ impl ::std::cmp::PartialEq for ip_frag_pkt { && self.frags == other.frags } } -#[doc = "< fragment mbuf"] +/// < fragment mbuf #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct rte_mbuf { diff --git a/tests/expectations/tests/layout_cmdline_token.rs b/tests/expectations/tests/layout_cmdline_token.rs index f5b0d1d1..e8b72843 100644 --- a/tests/expectations/tests/layout_cmdline_token.rs +++ b/tests/expectations/tests/layout_cmdline_token.rs @@ -7,8 +7,8 @@ non_upper_case_globals )] -#[doc = " Stores a pointer to the ops struct, and the offset: the place to"] -#[doc = " write the parsed result in the destination structure."] +/// Stores a pointer to the ops struct, and the offset: the place to +/// write the parsed result in the destination structure. #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct cmdline_token_hdr { @@ -54,27 +54,27 @@ impl Default for cmdline_token_hdr { } } pub type cmdline_parse_token_hdr_t = cmdline_token_hdr; -#[doc = " A token is defined by this structure."] -#[doc = ""] -#[doc = " parse() takes the token as first argument, then the source buffer"] -#[doc = " starting at the token we want to parse. The 3rd arg is a pointer"] -#[doc = " where we store the parsed data (as binary). It returns the number of"] -#[doc = " parsed chars on success and a negative value on error."] -#[doc = ""] -#[doc = " complete_get_nb() returns the number of possible values for this"] -#[doc = " token if completion is possible. If it is NULL or if it returns 0,"] -#[doc = " no completion is possible."] -#[doc = ""] -#[doc = " complete_get_elt() copy in dstbuf (the size is specified in the"] -#[doc = " parameter) the i-th possible completion for this token. returns 0"] -#[doc = " on success or and a negative value on error."] -#[doc = ""] -#[doc = " get_help() fills the dstbuf with the help for the token. It returns"] -#[doc = " -1 on error and 0 on success."] +/// A token is defined by this structure. +/// +/// parse() takes the token as first argument, then the source buffer +/// starting at the token we want to parse. The 3rd arg is a pointer +/// where we store the parsed data (as binary). It returns the number of +/// parsed chars on success and a negative value on error. +/// +/// complete_get_nb() returns the number of possible values for this +/// token if completion is possible. If it is NULL or if it returns 0, +/// no completion is possible. +/// +/// complete_get_elt() copy in dstbuf (the size is specified in the +/// parameter) the i-th possible completion for this token. returns 0 +/// on success or and a negative value on error. +/// +/// get_help() fills the dstbuf with the help for the token. It returns +/// -1 on error and 0 on success. #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct cmdline_token_ops { - #[doc = " parse(token ptr, buf, res pts, buf len)"] + /// parse(token ptr, buf, res pts, buf len) pub parse: ::std::option::Option< unsafe extern "C" fn( arg1: *mut cmdline_parse_token_hdr_t, @@ -83,11 +83,11 @@ pub struct cmdline_token_ops { arg4: ::std::os::raw::c_uint, ) -> ::std::os::raw::c_int, >, - #[doc = " return the num of possible choices for this token"] + /// return the num of possible choices for this token pub complete_get_nb: ::std::option::Option< unsafe extern "C" fn(arg1: *mut cmdline_parse_token_hdr_t) -> ::std::os::raw::c_int, >, - #[doc = " return the elt x for this token (token, idx, dstbuf, size)"] + /// return the elt x for this token (token, idx, dstbuf, size) pub complete_get_elt: ::std::option::Option< unsafe extern "C" fn( arg1: *mut cmdline_parse_token_hdr_t, @@ -96,7 +96,7 @@ pub struct cmdline_token_ops { arg4: ::std::os::raw::c_uint, ) -> ::std::os::raw::c_int, >, - #[doc = " get help for this token (token, dstbuf, size)"] + /// get help for this token (token, dstbuf, size) pub get_help: ::std::option::Option< unsafe extern "C" fn( arg1: *mut cmdline_parse_token_hdr_t, diff --git a/tests/expectations/tests/layout_eth_conf.rs b/tests/expectations/tests/layout_eth_conf.rs index 77e3d845..7fde7a1a 100644 --- a/tests/expectations/tests/layout_eth_conf.rs +++ b/tests/expectations/tests/layout_eth_conf.rs @@ -122,36 +122,36 @@ pub const RTE_ETH_FLOW_GENEVE: u32 = 20; pub const RTE_ETH_FLOW_NVGRE: u32 = 21; pub const RTE_ETH_FLOW_MAX: u32 = 22; #[repr(u32)] -#[doc = " A set of values to identify what method is to be used to route"] -#[doc = " packets to multiple queues."] +/// A set of values to identify what method is to be used to route +/// packets to multiple queues. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum rte_eth_rx_mq_mode { - #[doc = " None of DCB,RSS or VMDQ mode"] + /// None of DCB,RSS or VMDQ mode ETH_MQ_RX_NONE = 0, - #[doc = " For RX side, only RSS is on"] + /// For RX side, only RSS is on ETH_MQ_RX_RSS = 1, - #[doc = " For RX side,only DCB is on."] + /// For RX side,only DCB is on. ETH_MQ_RX_DCB = 2, - #[doc = " Both DCB and RSS enable"] + /// Both DCB and RSS enable ETH_MQ_RX_DCB_RSS = 3, - #[doc = " Only VMDQ, no RSS nor DCB"] + /// Only VMDQ, no RSS nor DCB ETH_MQ_RX_VMDQ_ONLY = 4, - #[doc = " RSS mode with VMDQ"] + /// RSS mode with VMDQ ETH_MQ_RX_VMDQ_RSS = 5, - #[doc = " Use VMDQ+DCB to route traffic to queues"] + /// Use VMDQ+DCB to route traffic to queues ETH_MQ_RX_VMDQ_DCB = 6, - #[doc = " Enable both VMDQ and DCB in VMDq"] + /// Enable both VMDQ and DCB in VMDq ETH_MQ_RX_VMDQ_DCB_RSS = 7, } -#[doc = " A structure used to configure the RX features of an Ethernet port."] +/// A structure used to configure the RX features of an Ethernet port. #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct rte_eth_rxmode { - #[doc = " The multi-queue packet distribution mode to be used, e.g. RSS."] + /// The multi-queue packet distribution mode to be used, e.g. RSS. pub mq_mode: rte_eth_rx_mq_mode, - #[doc = "< Only used if jumbo_frame enabled."] + /// < Only used if jumbo_frame enabled. pub max_rx_pkt_len: u32, - #[doc = "< hdr buf size (header_split enabled)."] + /// < hdr buf size (header_split enabled). pub split_hdr_size: u16, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize], u8>, } @@ -357,24 +357,24 @@ impl rte_eth_rxmode { } } #[repr(u32)] -#[doc = " A set of values to identify what method is to be used to transmit"] -#[doc = " packets using multi-TCs."] +/// A set of values to identify what method is to be used to transmit +/// packets using multi-TCs. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum rte_eth_tx_mq_mode { - #[doc = "< It is in neither DCB nor VT mode."] + /// < It is in neither DCB nor VT mode. ETH_MQ_TX_NONE = 0, - #[doc = "< For TX side,only DCB is on."] + /// < For TX side,only DCB is on. ETH_MQ_TX_DCB = 1, - #[doc = "< For TX side,both DCB and VT is on."] + /// < For TX side,both DCB and VT is on. ETH_MQ_TX_VMDQ_DCB = 2, - #[doc = "< Only VT on, no DCB"] + /// < Only VT on, no DCB ETH_MQ_TX_VMDQ_ONLY = 3, } -#[doc = " A structure used to configure the TX features of an Ethernet port."] +/// A structure used to configure the TX features of an Ethernet port. #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct rte_eth_txmode { - #[doc = "< TX multi-queues mode."] + /// < TX multi-queues mode. pub mq_mode: rte_eth_tx_mq_mode, pub pvid: u16, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, @@ -476,29 +476,29 @@ impl rte_eth_txmode { __bindgen_bitfield_unit } } -#[doc = " A structure used to configure the Receive Side Scaling (RSS) feature"] -#[doc = " of an Ethernet port."] -#[doc = " If not NULL, the *rss_key* pointer of the *rss_conf* structure points"] -#[doc = " to an array holding the RSS key to use for hashing specific header"] -#[doc = " fields of received packets. The length of this array should be indicated"] -#[doc = " by *rss_key_len* below. Otherwise, a default random hash key is used by"] -#[doc = " the device driver."] -#[doc = ""] -#[doc = " The *rss_key_len* field of the *rss_conf* structure indicates the length"] -#[doc = " in bytes of the array pointed by *rss_key*. To be compatible, this length"] -#[doc = " will be checked in i40e only. Others assume 40 bytes to be used as before."] -#[doc = ""] -#[doc = " The *rss_hf* field of the *rss_conf* structure indicates the different"] -#[doc = " types of IPv4/IPv6 packets to which the RSS hashing must be applied."] -#[doc = " Supplying an *rss_hf* equal to zero disables the RSS feature."] +/// A structure used to configure the Receive Side Scaling (RSS) feature +/// of an Ethernet port. +/// If not NULL, the *rss_key* pointer of the *rss_conf* structure points +/// to an array holding the RSS key to use for hashing specific header +/// fields of received packets. The length of this array should be indicated +/// by *rss_key_len* below. Otherwise, a default random hash key is used by +/// the device driver. +/// +/// The *rss_key_len* field of the *rss_conf* structure indicates the length +/// in bytes of the array pointed by *rss_key*. To be compatible, this length +/// will be checked in i40e only. Others assume 40 bytes to be used as before. +/// +/// The *rss_hf* field of the *rss_conf* structure indicates the different +/// types of IPv4/IPv6 packets to which the RSS hashing must be applied. +/// Supplying an *rss_hf* equal to zero disables the RSS feature. #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct rte_eth_rss_conf { - #[doc = "< If not NULL, 40-byte hash key."] + /// < If not NULL, 40-byte hash key. pub rss_key: *mut u8, - #[doc = "< hash key length in bytes."] + /// < hash key length in bytes. pub rss_key_len: u8, - #[doc = "< Hash functions to apply - see below."] + /// < Hash functions to apply - see below. pub rss_hf: u64, } #[test] @@ -550,59 +550,59 @@ impl Default for rte_eth_rss_conf { } } #[repr(u32)] -#[doc = " This enum indicates the possible number of traffic classes"] -#[doc = " in DCB configratioins"] +/// This enum indicates the possible number of traffic classes +/// in DCB configratioins #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum rte_eth_nb_tcs { - #[doc = "< 4 TCs with DCB."] + /// < 4 TCs with DCB. ETH_4_TCS = 4, - #[doc = "< 8 TCs with DCB."] + /// < 8 TCs with DCB. ETH_8_TCS = 8, } #[repr(u32)] -#[doc = " This enum indicates the possible number of queue pools"] -#[doc = " in VMDQ configurations."] +/// This enum indicates the possible number of queue pools +/// in VMDQ configurations. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum rte_eth_nb_pools { - #[doc = "< 8 VMDq pools."] + /// < 8 VMDq pools. ETH_8_POOLS = 8, - #[doc = "< 16 VMDq pools."] + /// < 16 VMDq pools. ETH_16_POOLS = 16, - #[doc = "< 32 VMDq pools."] + /// < 32 VMDq pools. ETH_32_POOLS = 32, - #[doc = "< 64 VMDq pools."] + /// < 64 VMDq pools. ETH_64_POOLS = 64, } -#[doc = " A structure used to configure the VMDQ+DCB feature"] -#[doc = " of an Ethernet port."] -#[doc = ""] -#[doc = " Using this feature, packets are routed to a pool of queues, based"] -#[doc = " on the vlan id in the vlan tag, and then to a specific queue within"] -#[doc = " that pool, using the user priority vlan tag field."] -#[doc = ""] -#[doc = " A default pool may be used, if desired, to route all traffic which"] -#[doc = " does not match the vlan filter rules."] +/// A structure used to configure the VMDQ+DCB feature +/// of an Ethernet port. +/// +/// Using this feature, packets are routed to a pool of queues, based +/// on the vlan id in the vlan tag, and then to a specific queue within +/// that pool, using the user priority vlan tag field. +/// +/// A default pool may be used, if desired, to route all traffic which +/// does not match the vlan filter rules. #[repr(C)] #[derive(Copy, Clone)] pub struct rte_eth_vmdq_dcb_conf { - #[doc = "< With DCB, 16 or 32 pools"] + /// < With DCB, 16 or 32 pools pub nb_queue_pools: rte_eth_nb_pools, - #[doc = "< If non-zero, use a default pool"] + /// < If non-zero, use a default pool pub enable_default_pool: u8, - #[doc = "< The default pool, if applicable"] + /// < The default pool, if applicable pub default_pool: u8, - #[doc = "< We can have up to 64 filters/mappings"] + /// < We can have up to 64 filters/mappings pub nb_pool_maps: u8, - #[doc = "< VMDq vlan pool maps."] + /// < VMDq vlan pool maps. pub pool_map: [rte_eth_vmdq_dcb_conf__bindgen_ty_1; 64usize], pub dcb_tc: [u8; 8usize], } #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct rte_eth_vmdq_dcb_conf__bindgen_ty_1 { - #[doc = "< The vlan id of the received frame"] + /// < The vlan id of the received frame pub vlan_id: u16, - #[doc = "< Bitmask of pools for packet rx"] + /// < Bitmask of pools for packet rx pub pools: u64, } #[test] @@ -737,9 +737,9 @@ impl Default for rte_eth_vmdq_dcb_conf { #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct rte_eth_dcb_rx_conf { - #[doc = "< Possible DCB TCs, 4 or 8 TCs"] + /// < Possible DCB TCs, 4 or 8 TCs pub nb_tcs: rte_eth_nb_tcs, - #[doc = " Traffic class each UP mapped to."] + /// Traffic class each UP mapped to. pub dcb_tc: [u8; 8usize], } #[test] @@ -783,9 +783,9 @@ impl Default for rte_eth_dcb_rx_conf { #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct rte_eth_vmdq_dcb_tx_conf { - #[doc = "< With DCB, 16 or 32 pools."] + /// < With DCB, 16 or 32 pools. pub nb_queue_pools: rte_eth_nb_pools, - #[doc = " Traffic class each UP mapped to."] + /// Traffic class each UP mapped to. pub dcb_tc: [u8; 8usize], } #[test] @@ -831,9 +831,9 @@ impl Default for rte_eth_vmdq_dcb_tx_conf { #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct rte_eth_dcb_tx_conf { - #[doc = "< Possible DCB TCs, 4 or 8 TCs."] + /// < Possible DCB TCs, 4 or 8 TCs. pub nb_tcs: rte_eth_nb_tcs, - #[doc = " Traffic class each UP mapped to."] + /// Traffic class each UP mapped to. pub dcb_tc: [u8; 8usize], } #[test] @@ -877,7 +877,7 @@ impl Default for rte_eth_dcb_tx_conf { #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct rte_eth_vmdq_tx_conf { - #[doc = "< VMDq mode, 64 pools."] + /// < VMDq mode, 64 pools. pub nb_queue_pools: rte_eth_nb_pools, } #[test] @@ -913,27 +913,27 @@ impl Default for rte_eth_vmdq_tx_conf { #[repr(C)] #[derive(Copy, Clone)] pub struct rte_eth_vmdq_rx_conf { - #[doc = "< VMDq only mode, 8 or 64 pools"] + /// < VMDq only mode, 8 or 64 pools pub nb_queue_pools: rte_eth_nb_pools, - #[doc = "< If non-zero, use a default pool"] + /// < If non-zero, use a default pool pub enable_default_pool: u8, - #[doc = "< The default pool, if applicable"] + /// < The default pool, if applicable pub default_pool: u8, - #[doc = "< Enable VT loop back"] + /// < Enable VT loop back pub enable_loop_back: u8, - #[doc = "< We can have up to 64 filters/mappings"] + /// < We can have up to 64 filters/mappings pub nb_pool_maps: u8, - #[doc = "< Flags from ETH_VMDQ_ACCEPT_*"] + /// < Flags from ETH_VMDQ_ACCEPT_* pub rx_mode: u32, - #[doc = "< VMDq vlan pool maps."] + /// < VMDq vlan pool maps. pub pool_map: [rte_eth_vmdq_rx_conf__bindgen_ty_1; 64usize], } #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct rte_eth_vmdq_rx_conf__bindgen_ty_1 { - #[doc = "< The vlan id of the received frame"] + /// < The vlan id of the received frame pub vlan_id: u16, - #[doc = "< Bitmask of pools for packet rx"] + /// < Bitmask of pools for packet rx pub pools: u64, } #[test] @@ -1078,56 +1078,56 @@ impl Default for rte_eth_vmdq_rx_conf { } } #[repr(u32)] -#[doc = " Flow Director setting modes: none, signature or perfect."] +/// Flow Director setting modes: none, signature or perfect. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum rte_fdir_mode { - #[doc = "< Disable FDIR support."] + /// < Disable FDIR support. RTE_FDIR_MODE_NONE = 0, - #[doc = "< Enable FDIR signature filter mode."] + /// < Enable FDIR signature filter mode. RTE_FDIR_MODE_SIGNATURE = 1, - #[doc = "< Enable FDIR perfect filter mode."] + /// < Enable FDIR perfect filter mode. RTE_FDIR_MODE_PERFECT = 2, - #[doc = "< Enable FDIR filter mode - MAC VLAN."] + /// < Enable FDIR filter mode - MAC VLAN. RTE_FDIR_MODE_PERFECT_MAC_VLAN = 3, - #[doc = "< Enable FDIR filter mode - tunnel."] + /// < Enable FDIR filter mode - tunnel. RTE_FDIR_MODE_PERFECT_TUNNEL = 4, } #[repr(u32)] -#[doc = " Memory space that can be configured to store Flow Director filters"] -#[doc = " in the board memory."] +/// Memory space that can be configured to store Flow Director filters +/// in the board memory. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum rte_fdir_pballoc_type { - #[doc = "< 64k."] + /// < 64k. RTE_FDIR_PBALLOC_64K = 0, - #[doc = "< 128k."] + /// < 128k. RTE_FDIR_PBALLOC_128K = 1, - #[doc = "< 256k."] + /// < 256k. RTE_FDIR_PBALLOC_256K = 2, } #[repr(u32)] -#[doc = " Select report mode of FDIR hash information in RX descriptors."] +/// Select report mode of FDIR hash information in RX descriptors. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum rte_fdir_status_mode { - #[doc = "< Never report FDIR hash."] + /// < Never report FDIR hash. RTE_FDIR_NO_REPORT_STATUS = 0, - #[doc = "< Only report FDIR hash for matching pkts."] + /// < Only report FDIR hash for matching pkts. RTE_FDIR_REPORT_STATUS = 1, - #[doc = "< Always report FDIR hash."] + /// < Always report FDIR hash. RTE_FDIR_REPORT_STATUS_ALWAYS = 2, } -#[doc = " A structure used to define the input for IPV4 flow"] +/// A structure used to define the input for IPV4 flow #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct rte_eth_ipv4_flow { - #[doc = "< IPv4 source address in big endian."] + /// < IPv4 source address in big endian. pub src_ip: u32, - #[doc = "< IPv4 destination address in big endian."] + /// < IPv4 destination address in big endian. pub dst_ip: u32, - #[doc = "< Type of service to match."] + /// < Type of service to match. pub tos: u8, - #[doc = "< Time to live to match."] + /// < Time to live to match. pub ttl: u8, - #[doc = "< Protocol, next header in big endian."] + /// < Protocol, next header in big endian. pub proto: u8, } #[test] @@ -1193,19 +1193,19 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() { ) ); } -#[doc = " A structure used to define the input for IPV6 flow"] +/// A structure used to define the input for IPV6 flow #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct rte_eth_ipv6_flow { - #[doc = "< IPv6 source address in big endian."] + /// < IPv6 source address in big endian. pub src_ip: [u32; 4usize], - #[doc = "< IPv6 destination address in big endian."] + /// < IPv6 destination address in big endian. pub dst_ip: [u32; 4usize], - #[doc = "< Traffic class to match."] + /// < Traffic class to match. pub tc: u8, - #[doc = "< Protocol, next header to match."] + /// < Protocol, next header to match. pub proto: u8, - #[doc = "< Hop limits to match."] + /// < Hop limits to match. pub hop_limits: u8, } #[test] @@ -1271,28 +1271,28 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() { ) ); } -#[doc = " A structure used to configure FDIR masks that are used by the device"] -#[doc = " to match the various fields of RX packet headers."] +/// A structure used to configure FDIR masks that are used by the device +/// to match the various fields of RX packet headers. #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct rte_eth_fdir_masks { - #[doc = "< Bit mask for vlan_tci in big endian"] + /// < Bit mask for vlan_tci in big endian pub vlan_tci_mask: u16, - #[doc = " Bit mask for ipv4 flow in big endian."] + /// Bit mask for ipv4 flow in big endian. pub ipv4_mask: rte_eth_ipv4_flow, - #[doc = " Bit maks for ipv6 flow in big endian."] + /// Bit maks for ipv6 flow in big endian. pub ipv6_mask: rte_eth_ipv6_flow, - #[doc = " Bit mask for L4 source port in big endian."] + /// Bit mask for L4 source port in big endian. pub src_port_mask: u16, - #[doc = " Bit mask for L4 destination port in big endian."] + /// Bit mask for L4 destination port in big endian. pub dst_port_mask: u16, - #[doc = " 6 bit mask for proper 6 bytes of Mac address, bit 0 matches the"] - #[doc = "first byte on the wire"] + /// 6 bit mask for proper 6 bytes of Mac address, bit 0 matches the + /// first byte on the wire pub mac_addr_byte_mask: u8, - #[doc = " Bit mask for tunnel ID in big endian."] + /// Bit mask for tunnel ID in big endian. pub tunnel_id_mask: u32, - #[doc = "< 1 - Match tunnel type,"] - #[doc = "0 - Ignore tunnel type."] + /// < 1 - Match tunnel type, + /// 0 - Ignore tunnel type. pub tunnel_type_mask: u8, } #[test] @@ -1401,7 +1401,7 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); } #[repr(u32)] -#[doc = " Payload type"] +/// Payload type #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum rte_eth_payload_type { RTE_ETH_PAYLOAD_UNKNOWN = 0, @@ -1411,12 +1411,12 @@ pub enum rte_eth_payload_type { RTE_ETH_L4_PAYLOAD = 4, RTE_ETH_PAYLOAD_MAX = 8, } -#[doc = " A structure used to select bytes extracted from the protocol layers to"] -#[doc = " flexible payload for filter"] +/// A structure used to select bytes extracted from the protocol layers to +/// flexible payload for filter #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct rte_eth_flex_payload_cfg { - #[doc = "< Payload type"] + /// < Payload type pub type_: rte_eth_payload_type, pub src_offset: [u16; 16usize], } @@ -1460,8 +1460,8 @@ impl Default for rte_eth_flex_payload_cfg { unsafe { ::std::mem::zeroed() } } } -#[doc = " A structure used to define FDIR masks for flexible payload"] -#[doc = " for each flow type"] +/// A structure used to define FDIR masks for flexible payload +/// for each flow type #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct rte_eth_fdir_flex_mask { @@ -1503,14 +1503,14 @@ fn bindgen_test_layout_rte_eth_fdir_flex_mask() { ) ); } -#[doc = " A structure used to define all flexible payload related setting"] -#[doc = " include flex payload and flex mask"] +/// A structure used to define all flexible payload related setting +/// include flex payload and flex mask #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct rte_eth_fdir_flex_conf { - #[doc = "< The number of following payload cfg"] + /// < The number of following payload cfg pub nb_payloads: u16, - #[doc = "< The number of following mask"] + /// < The number of following mask pub nb_flexmasks: u16, pub flex_set: [rte_eth_flex_payload_cfg; 8usize], pub flex_mask: [rte_eth_fdir_flex_mask; 22usize], @@ -1579,20 +1579,20 @@ impl Default for rte_eth_fdir_flex_conf { unsafe { ::std::mem::zeroed() } } } -#[doc = " A structure used to configure the Flow Director (FDIR) feature"] -#[doc = " of an Ethernet port."] -#[doc = ""] -#[doc = " If mode is RTE_FDIR_DISABLE, the pballoc value is ignored."] +/// A structure used to configure the Flow Director (FDIR) feature +/// of an Ethernet port. +/// +/// If mode is RTE_FDIR_DISABLE, the pballoc value is ignored. #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct rte_fdir_conf { - #[doc = "< Flow Director mode."] + /// < Flow Director mode. pub mode: rte_fdir_mode, - #[doc = "< Space for FDIR filters."] + /// < Space for FDIR filters. pub pballoc: rte_fdir_pballoc_type, - #[doc = "< How to report FDIR hash."] + /// < How to report FDIR hash. pub status: rte_fdir_status_mode, - #[doc = " RX queue of packets matching a \"drop\" filter in perfect mode."] + /// RX queue of packets matching a "drop" filter in perfect mode. pub drop_queue: u8, pub mask: rte_eth_fdir_masks, pub flex_conf: rte_eth_fdir_flex_conf, @@ -1675,13 +1675,13 @@ impl Default for rte_fdir_conf { unsafe { ::std::mem::zeroed() } } } -#[doc = " A structure used to enable/disable specific device interrupts."] +/// A structure used to enable/disable specific device interrupts. #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct rte_intr_conf { - #[doc = " enable/disable lsc interrupt. 0 (default) - disable, 1 enable"] + /// enable/disable lsc interrupt. 0 (default) - disable, 1 enable pub lsc: u16, - #[doc = " enable/disable rxq interrupt. 0 (default) - disable, 1 enable"] + /// enable/disable rxq interrupt. 0 (default) - disable, 1 enable pub rxq: u16, } #[test] @@ -1717,46 +1717,46 @@ fn bindgen_test_layout_rte_intr_conf() { ) ); } -#[doc = " A structure used to configure an Ethernet port."] -#[doc = " Depending upon the RX multi-queue mode, extra advanced"] -#[doc = " configuration settings may be needed."] +/// A structure used to configure an Ethernet port. +/// Depending upon the RX multi-queue mode, extra advanced +/// configuration settings may be needed. #[repr(C)] #[derive(Copy, Clone)] pub struct rte_eth_conf { - #[doc = "< bitmap of ETH_LINK_SPEED_XXX of speeds to be"] - #[doc = "used. ETH_LINK_SPEED_FIXED disables link"] - #[doc = "autonegotiation, and a unique speed shall be"] - #[doc = "set. Otherwise, the bitmap defines the set of"] - #[doc = "speeds to be advertised. If the special value"] - #[doc = "ETH_LINK_SPEED_AUTONEG (0) is used, all speeds"] - #[doc = "supported are advertised."] + /// < bitmap of ETH_LINK_SPEED_XXX of speeds to be + /// used. ETH_LINK_SPEED_FIXED disables link + /// autonegotiation, and a unique speed shall be + /// set. Otherwise, the bitmap defines the set of + /// speeds to be advertised. If the special value + /// ETH_LINK_SPEED_AUTONEG (0) is used, all speeds + /// supported are advertised. pub link_speeds: u32, - #[doc = "< Port RX configuration."] + /// < Port RX configuration. pub rxmode: rte_eth_rxmode, - #[doc = "< Port TX configuration."] + /// < Port TX configuration. pub txmode: rte_eth_txmode, - #[doc = "< Loopback operation mode. By default the value"] - #[doc = "is 0, meaning the loopback mode is disabled."] - #[doc = "Read the datasheet of given ethernet controller"] - #[doc = "for details. The possible values of this field"] - #[doc = "are defined in implementation of each driver."] + /// < Loopback operation mode. By default the value + /// is 0, meaning the loopback mode is disabled. + /// Read the datasheet of given ethernet controller + /// for details. The possible values of this field + /// are defined in implementation of each driver. pub lpbk_mode: u32, - #[doc = "< Port RX filtering configuration (union)."] + /// < Port RX filtering configuration (union). pub rx_adv_conf: rte_eth_conf__bindgen_ty_1, - #[doc = "< Port TX DCB configuration (union)."] + /// < Port TX DCB configuration (union). pub tx_adv_conf: rte_eth_conf__bindgen_ty_2, - #[doc = " Currently,Priority Flow Control(PFC) are supported,if DCB with PFC"] - #[doc = "is needed,and the variable must be set ETH_DCB_PFC_SUPPORT."] + /// Currently,Priority Flow Control(PFC) are supported,if DCB with PFC + /// is needed,and the variable must be set ETH_DCB_PFC_SUPPORT. pub dcb_capability_en: u32, - #[doc = "< FDIR configuration."] + /// < FDIR configuration. pub fdir_conf: rte_fdir_conf, - #[doc = "< Interrupt mode configuration."] + /// < Interrupt mode configuration. pub intr_conf: rte_intr_conf, } #[repr(C)] #[derive(Copy, Clone)] pub struct rte_eth_conf__bindgen_ty_1 { - #[doc = "< Port RSS configuration"] + /// < Port RSS configuration pub rss_conf: rte_eth_rss_conf, pub vmdq_dcb_conf: rte_eth_vmdq_dcb_conf, pub dcb_rx_conf: rte_eth_dcb_rx_conf, diff --git a/tests/expectations/tests/layout_eth_conf_1_0.rs b/tests/expectations/tests/layout_eth_conf_1_0.rs index ad86bc07..220a4f7c 100644 --- a/tests/expectations/tests/layout_eth_conf_1_0.rs +++ b/tests/expectations/tests/layout_eth_conf_1_0.rs @@ -165,36 +165,36 @@ pub const RTE_ETH_FLOW_GENEVE: u32 = 20; pub const RTE_ETH_FLOW_NVGRE: u32 = 21; pub const RTE_ETH_FLOW_MAX: u32 = 22; #[repr(u32)] -#[doc = " A set of values to identify what method is to be used to route"] -#[doc = " packets to multiple queues."] +/// A set of values to identify what method is to be used to route +/// packets to multiple queues. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum rte_eth_rx_mq_mode { - #[doc = " None of DCB,RSS or VMDQ mode"] + /// None of DCB,RSS or VMDQ mode ETH_MQ_RX_NONE = 0, - #[doc = " For RX side, only RSS is on"] + /// For RX side, only RSS is on ETH_MQ_RX_RSS = 1, - #[doc = " For RX side,only DCB is on."] + /// For RX side,only DCB is on. ETH_MQ_RX_DCB = 2, - #[doc = " Both DCB and RSS enable"] + /// Both DCB and RSS enable ETH_MQ_RX_DCB_RSS = 3, - #[doc = " Only VMDQ, no RSS nor DCB"] + /// Only VMDQ, no RSS nor DCB ETH_MQ_RX_VMDQ_ONLY = 4, - #[doc = " RSS mode with VMDQ"] + /// RSS mode with VMDQ ETH_MQ_RX_VMDQ_RSS = 5, - #[doc = " Use VMDQ+DCB to route traffic to queues"] + /// Use VMDQ+DCB to route traffic to queues ETH_MQ_RX_VMDQ_DCB = 6, - #[doc = " Enable both VMDQ and DCB in VMDq"] + /// Enable both VMDQ and DCB in VMDq ETH_MQ_RX_VMDQ_DCB_RSS = 7, } -#[doc = " A structure used to configure the RX features of an Ethernet port."] +/// A structure used to configure the RX features of an Ethernet port. #[repr(C)] #[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_rxmode { - #[doc = " The multi-queue packet distribution mode to be used, e.g. RSS."] + /// The multi-queue packet distribution mode to be used, e.g. RSS. pub mq_mode: rte_eth_rx_mq_mode, - #[doc = "< Only used if jumbo_frame enabled."] + /// < Only used if jumbo_frame enabled. pub max_rx_pkt_len: u32, - #[doc = "< hdr buf size (header_split enabled)."] + /// < hdr buf size (header_split enabled). pub split_hdr_size: u16, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize], u8>, } @@ -405,24 +405,24 @@ impl rte_eth_rxmode { } } #[repr(u32)] -#[doc = " A set of values to identify what method is to be used to transmit"] -#[doc = " packets using multi-TCs."] +/// A set of values to identify what method is to be used to transmit +/// packets using multi-TCs. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum rte_eth_tx_mq_mode { - #[doc = "< It is in neither DCB nor VT mode."] + /// < It is in neither DCB nor VT mode. ETH_MQ_TX_NONE = 0, - #[doc = "< For TX side,only DCB is on."] + /// < For TX side,only DCB is on. ETH_MQ_TX_DCB = 1, - #[doc = "< For TX side,both DCB and VT is on."] + /// < For TX side,both DCB and VT is on. ETH_MQ_TX_VMDQ_DCB = 2, - #[doc = "< Only VT on, no DCB"] + /// < Only VT on, no DCB ETH_MQ_TX_VMDQ_ONLY = 3, } -#[doc = " A structure used to configure the TX features of an Ethernet port."] +/// A structure used to configure the TX features of an Ethernet port. #[repr(C)] #[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_txmode { - #[doc = "< TX multi-queues mode."] + /// < TX multi-queues mode. pub mq_mode: rte_eth_tx_mq_mode, pub pvid: u16, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, @@ -529,29 +529,29 @@ impl rte_eth_txmode { __bindgen_bitfield_unit } } -#[doc = " A structure used to configure the Receive Side Scaling (RSS) feature"] -#[doc = " of an Ethernet port."] -#[doc = " If not NULL, the *rss_key* pointer of the *rss_conf* structure points"] -#[doc = " to an array holding the RSS key to use for hashing specific header"] -#[doc = " fields of received packets. The length of this array should be indicated"] -#[doc = " by *rss_key_len* below. Otherwise, a default random hash key is used by"] -#[doc = " the device driver."] -#[doc = ""] -#[doc = " The *rss_key_len* field of the *rss_conf* structure indicates the length"] -#[doc = " in bytes of the array pointed by *rss_key*. To be compatible, this length"] -#[doc = " will be checked in i40e only. Others assume 40 bytes to be used as before."] -#[doc = ""] -#[doc = " The *rss_hf* field of the *rss_conf* structure indicates the different"] -#[doc = " types of IPv4/IPv6 packets to which the RSS hashing must be applied."] -#[doc = " Supplying an *rss_hf* equal to zero disables the RSS feature."] +/// A structure used to configure the Receive Side Scaling (RSS) feature +/// of an Ethernet port. +/// If not NULL, the *rss_key* pointer of the *rss_conf* structure points +/// to an array holding the RSS key to use for hashing specific header +/// fields of received packets. The length of this array should be indicated +/// by *rss_key_len* below. Otherwise, a default random hash key is used by +/// the device driver. +/// +/// The *rss_key_len* field of the *rss_conf* structure indicates the length +/// in bytes of the array pointed by *rss_key*. To be compatible, this length +/// will be checked in i40e only. Others assume 40 bytes to be used as before. +/// +/// The *rss_hf* field of the *rss_conf* structure indicates the different +/// types of IPv4/IPv6 packets to which the RSS hashing must be applied. +/// Supplying an *rss_hf* equal to zero disables the RSS feature. #[repr(C)] #[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_rss_conf { - #[doc = "< If not NULL, 40-byte hash key."] + /// < If not NULL, 40-byte hash key. pub rss_key: *mut u8, - #[doc = "< hash key length in bytes."] + /// < hash key length in bytes. pub rss_key_len: u8, - #[doc = "< Hash functions to apply - see below."] + /// < Hash functions to apply - see below. pub rss_hf: u64, } #[test] @@ -608,59 +608,59 @@ impl Default for rte_eth_rss_conf { } } #[repr(u32)] -#[doc = " This enum indicates the possible number of traffic classes"] -#[doc = " in DCB configratioins"] +/// This enum indicates the possible number of traffic classes +/// in DCB configratioins #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum rte_eth_nb_tcs { - #[doc = "< 4 TCs with DCB."] + /// < 4 TCs with DCB. ETH_4_TCS = 4, - #[doc = "< 8 TCs with DCB."] + /// < 8 TCs with DCB. ETH_8_TCS = 8, } #[repr(u32)] -#[doc = " This enum indicates the possible number of queue pools"] -#[doc = " in VMDQ configurations."] +/// This enum indicates the possible number of queue pools +/// in VMDQ configurations. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum rte_eth_nb_pools { - #[doc = "< 8 VMDq pools."] + /// < 8 VMDq pools. ETH_8_POOLS = 8, - #[doc = "< 16 VMDq pools."] + /// < 16 VMDq pools. ETH_16_POOLS = 16, - #[doc = "< 32 VMDq pools."] + /// < 32 VMDq pools. ETH_32_POOLS = 32, - #[doc = "< 64 VMDq pools."] + /// < 64 VMDq pools. ETH_64_POOLS = 64, } -#[doc = " A structure used to configure the VMDQ+DCB feature"] -#[doc = " of an Ethernet port."] -#[doc = ""] -#[doc = " Using this feature, packets are routed to a pool of queues, based"] -#[doc = " on the vlan id in the vlan tag, and then to a specific queue within"] -#[doc = " that pool, using the user priority vlan tag field."] -#[doc = ""] -#[doc = " A default pool may be used, if desired, to route all traffic which"] -#[doc = " does not match the vlan filter rules."] +/// A structure used to configure the VMDQ+DCB feature +/// of an Ethernet port. +/// +/// Using this feature, packets are routed to a pool of queues, based +/// on the vlan id in the vlan tag, and then to a specific queue within +/// that pool, using the user priority vlan tag field. +/// +/// A default pool may be used, if desired, to route all traffic which +/// does not match the vlan filter rules. #[repr(C)] #[derive(Copy)] pub struct rte_eth_vmdq_dcb_conf { - #[doc = "< With DCB, 16 or 32 pools"] + /// < With DCB, 16 or 32 pools pub nb_queue_pools: rte_eth_nb_pools, - #[doc = "< If non-zero, use a default pool"] + /// < If non-zero, use a default pool pub enable_default_pool: u8, - #[doc = "< The default pool, if applicable"] + /// < The default pool, if applicable pub default_pool: u8, - #[doc = "< We can have up to 64 filters/mappings"] + /// < We can have up to 64 filters/mappings pub nb_pool_maps: u8, - #[doc = "< VMDq vlan pool maps."] + /// < VMDq vlan pool maps. pub pool_map: [rte_eth_vmdq_dcb_conf__bindgen_ty_1; 64usize], pub dcb_tc: [u8; 8usize], } #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_vmdq_dcb_conf__bindgen_ty_1 { - #[doc = "< The vlan id of the received frame"] + /// < The vlan id of the received frame pub vlan_id: u16, - #[doc = "< Bitmask of pools for packet rx"] + /// < Bitmask of pools for packet rx pub pools: u64, } #[test] @@ -805,9 +805,9 @@ impl Default for rte_eth_vmdq_dcb_conf { #[repr(C)] #[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_dcb_rx_conf { - #[doc = "< Possible DCB TCs, 4 or 8 TCs"] + /// < Possible DCB TCs, 4 or 8 TCs pub nb_tcs: rte_eth_nb_tcs, - #[doc = " Traffic class each UP mapped to."] + /// Traffic class each UP mapped to. pub dcb_tc: [u8; 8usize], } #[test] @@ -856,9 +856,9 @@ impl Default for rte_eth_dcb_rx_conf { #[repr(C)] #[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_vmdq_dcb_tx_conf { - #[doc = "< With DCB, 16 or 32 pools."] + /// < With DCB, 16 or 32 pools. pub nb_queue_pools: rte_eth_nb_pools, - #[doc = " Traffic class each UP mapped to."] + /// Traffic class each UP mapped to. pub dcb_tc: [u8; 8usize], } #[test] @@ -909,9 +909,9 @@ impl Default for rte_eth_vmdq_dcb_tx_conf { #[repr(C)] #[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_dcb_tx_conf { - #[doc = "< Possible DCB TCs, 4 or 8 TCs."] + /// < Possible DCB TCs, 4 or 8 TCs. pub nb_tcs: rte_eth_nb_tcs, - #[doc = " Traffic class each UP mapped to."] + /// Traffic class each UP mapped to. pub dcb_tc: [u8; 8usize], } #[test] @@ -960,7 +960,7 @@ impl Default for rte_eth_dcb_tx_conf { #[repr(C)] #[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_vmdq_tx_conf { - #[doc = "< VMDq mode, 64 pools."] + /// < VMDq mode, 64 pools. pub nb_queue_pools: rte_eth_nb_pools, } #[test] @@ -1001,27 +1001,27 @@ impl Default for rte_eth_vmdq_tx_conf { #[repr(C)] #[derive(Copy)] pub struct rte_eth_vmdq_rx_conf { - #[doc = "< VMDq only mode, 8 or 64 pools"] + /// < VMDq only mode, 8 or 64 pools pub nb_queue_pools: rte_eth_nb_pools, - #[doc = "< If non-zero, use a default pool"] + /// < If non-zero, use a default pool pub enable_default_pool: u8, - #[doc = "< The default pool, if applicable"] + /// < The default pool, if applicable pub default_pool: u8, - #[doc = "< Enable VT loop back"] + /// < Enable VT loop back pub enable_loop_back: u8, - #[doc = "< We can have up to 64 filters/mappings"] + /// < We can have up to 64 filters/mappings pub nb_pool_maps: u8, - #[doc = "< Flags from ETH_VMDQ_ACCEPT_*"] + /// < Flags from ETH_VMDQ_ACCEPT_* pub rx_mode: u32, - #[doc = "< VMDq vlan pool maps."] + /// < VMDq vlan pool maps. pub pool_map: [rte_eth_vmdq_rx_conf__bindgen_ty_1; 64usize], } #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_vmdq_rx_conf__bindgen_ty_1 { - #[doc = "< The vlan id of the received frame"] + /// < The vlan id of the received frame pub vlan_id: u16, - #[doc = "< Bitmask of pools for packet rx"] + /// < Bitmask of pools for packet rx pub pools: u64, } #[test] @@ -1176,56 +1176,56 @@ impl Default for rte_eth_vmdq_rx_conf { } } #[repr(u32)] -#[doc = " Flow Director setting modes: none, signature or perfect."] +/// Flow Director setting modes: none, signature or perfect. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum rte_fdir_mode { - #[doc = "< Disable FDIR support."] + /// < Disable FDIR support. RTE_FDIR_MODE_NONE = 0, - #[doc = "< Enable FDIR signature filter mode."] + /// < Enable FDIR signature filter mode. RTE_FDIR_MODE_SIGNATURE = 1, - #[doc = "< Enable FDIR perfect filter mode."] + /// < Enable FDIR perfect filter mode. RTE_FDIR_MODE_PERFECT = 2, - #[doc = "< Enable FDIR filter mode - MAC VLAN."] + /// < Enable FDIR filter mode - MAC VLAN. RTE_FDIR_MODE_PERFECT_MAC_VLAN = 3, - #[doc = "< Enable FDIR filter mode - tunnel."] + /// < Enable FDIR filter mode - tunnel. RTE_FDIR_MODE_PERFECT_TUNNEL = 4, } #[repr(u32)] -#[doc = " Memory space that can be configured to store Flow Director filters"] -#[doc = " in the board memory."] +/// Memory space that can be configured to store Flow Director filters +/// in the board memory. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum rte_fdir_pballoc_type { - #[doc = "< 64k."] + /// < 64k. RTE_FDIR_PBALLOC_64K = 0, - #[doc = "< 128k."] + /// < 128k. RTE_FDIR_PBALLOC_128K = 1, - #[doc = "< 256k."] + /// < 256k. RTE_FDIR_PBALLOC_256K = 2, } #[repr(u32)] -#[doc = " Select report mode of FDIR hash information in RX descriptors."] +/// Select report mode of FDIR hash information in RX descriptors. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum rte_fdir_status_mode { - #[doc = "< Never report FDIR hash."] + /// < Never report FDIR hash. RTE_FDIR_NO_REPORT_STATUS = 0, - #[doc = "< Only report FDIR hash for matching pkts."] + /// < Only report FDIR hash for matching pkts. RTE_FDIR_REPORT_STATUS = 1, - #[doc = "< Always report FDIR hash."] + /// < Always report FDIR hash. RTE_FDIR_REPORT_STATUS_ALWAYS = 2, } -#[doc = " A structure used to define the input for IPV4 flow"] +/// A structure used to define the input for IPV4 flow #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_ipv4_flow { - #[doc = "< IPv4 source address in big endian."] + /// < IPv4 source address in big endian. pub src_ip: u32, - #[doc = "< IPv4 destination address in big endian."] + /// < IPv4 destination address in big endian. pub dst_ip: u32, - #[doc = "< Type of service to match."] + /// < Type of service to match. pub tos: u8, - #[doc = "< Time to live to match."] + /// < Time to live to match. pub ttl: u8, - #[doc = "< Protocol, next header in big endian."] + /// < Protocol, next header in big endian. pub proto: u8, } #[test] @@ -1296,19 +1296,19 @@ impl Clone for rte_eth_ipv4_flow { *self } } -#[doc = " A structure used to define the input for IPV6 flow"] +/// A structure used to define the input for IPV6 flow #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_ipv6_flow { - #[doc = "< IPv6 source address in big endian."] + /// < IPv6 source address in big endian. pub src_ip: [u32; 4usize], - #[doc = "< IPv6 destination address in big endian."] + /// < IPv6 destination address in big endian. pub dst_ip: [u32; 4usize], - #[doc = "< Traffic class to match."] + /// < Traffic class to match. pub tc: u8, - #[doc = "< Protocol, next header to match."] + /// < Protocol, next header to match. pub proto: u8, - #[doc = "< Hop limits to match."] + /// < Hop limits to match. pub hop_limits: u8, } #[test] @@ -1379,28 +1379,28 @@ impl Clone for rte_eth_ipv6_flow { *self } } -#[doc = " A structure used to configure FDIR masks that are used by the device"] -#[doc = " to match the various fields of RX packet headers."] +/// A structure used to configure FDIR masks that are used by the device +/// to match the various fields of RX packet headers. #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_fdir_masks { - #[doc = "< Bit mask for vlan_tci in big endian"] + /// < Bit mask for vlan_tci in big endian pub vlan_tci_mask: u16, - #[doc = " Bit mask for ipv4 flow in big endian."] + /// Bit mask for ipv4 flow in big endian. pub ipv4_mask: rte_eth_ipv4_flow, - #[doc = " Bit maks for ipv6 flow in big endian."] + /// Bit maks for ipv6 flow in big endian. pub ipv6_mask: rte_eth_ipv6_flow, - #[doc = " Bit mask for L4 source port in big endian."] + /// Bit mask for L4 source port in big endian. pub src_port_mask: u16, - #[doc = " Bit mask for L4 destination port in big endian."] + /// Bit mask for L4 destination port in big endian. pub dst_port_mask: u16, - #[doc = " 6 bit mask for proper 6 bytes of Mac address, bit 0 matches the"] - #[doc = "first byte on the wire"] + /// 6 bit mask for proper 6 bytes of Mac address, bit 0 matches the + /// first byte on the wire pub mac_addr_byte_mask: u8, - #[doc = " Bit mask for tunnel ID in big endian."] + /// Bit mask for tunnel ID in big endian. pub tunnel_id_mask: u32, - #[doc = "< 1 - Match tunnel type,"] - #[doc = "0 - Ignore tunnel type."] + /// < 1 - Match tunnel type, + /// 0 - Ignore tunnel type. pub tunnel_type_mask: u8, } #[test] @@ -1514,7 +1514,7 @@ impl Clone for rte_eth_fdir_masks { } } #[repr(u32)] -#[doc = " Payload type"] +/// Payload type #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum rte_eth_payload_type { RTE_ETH_PAYLOAD_UNKNOWN = 0, @@ -1524,12 +1524,12 @@ pub enum rte_eth_payload_type { RTE_ETH_L4_PAYLOAD = 4, RTE_ETH_PAYLOAD_MAX = 8, } -#[doc = " A structure used to select bytes extracted from the protocol layers to"] -#[doc = " flexible payload for filter"] +/// A structure used to select bytes extracted from the protocol layers to +/// flexible payload for filter #[repr(C)] #[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_flex_payload_cfg { - #[doc = "< Payload type"] + /// < Payload type pub type_: rte_eth_payload_type, pub src_offset: [u16; 16usize], } @@ -1578,8 +1578,8 @@ impl Default for rte_eth_flex_payload_cfg { unsafe { ::std::mem::zeroed() } } } -#[doc = " A structure used to define FDIR masks for flexible payload"] -#[doc = " for each flow type"] +/// A structure used to define FDIR masks for flexible payload +/// for each flow type #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_fdir_flex_mask { @@ -1626,14 +1626,14 @@ impl Clone for rte_eth_fdir_flex_mask { *self } } -#[doc = " A structure used to define all flexible payload related setting"] -#[doc = " include flex payload and flex mask"] +/// A structure used to define all flexible payload related setting +/// include flex payload and flex mask #[repr(C)] #[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_fdir_flex_conf { - #[doc = "< The number of following payload cfg"] + /// < The number of following payload cfg pub nb_payloads: u16, - #[doc = "< The number of following mask"] + /// < The number of following mask pub nb_flexmasks: u16, pub flex_set: [rte_eth_flex_payload_cfg; 8usize], pub flex_mask: [rte_eth_fdir_flex_mask; 22usize], @@ -1707,20 +1707,20 @@ impl Default for rte_eth_fdir_flex_conf { unsafe { ::std::mem::zeroed() } } } -#[doc = " A structure used to configure the Flow Director (FDIR) feature"] -#[doc = " of an Ethernet port."] -#[doc = ""] -#[doc = " If mode is RTE_FDIR_DISABLE, the pballoc value is ignored."] +/// A structure used to configure the Flow Director (FDIR) feature +/// of an Ethernet port. +/// +/// If mode is RTE_FDIR_DISABLE, the pballoc value is ignored. #[repr(C)] #[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct rte_fdir_conf { - #[doc = "< Flow Director mode."] + /// < Flow Director mode. pub mode: rte_fdir_mode, - #[doc = "< Space for FDIR filters."] + /// < Space for FDIR filters. pub pballoc: rte_fdir_pballoc_type, - #[doc = "< How to report FDIR hash."] + /// < How to report FDIR hash. pub status: rte_fdir_status_mode, - #[doc = " RX queue of packets matching a \"drop\" filter in perfect mode."] + /// RX queue of packets matching a "drop" filter in perfect mode. pub drop_queue: u8, pub mask: rte_eth_fdir_masks, pub flex_conf: rte_eth_fdir_flex_conf, @@ -1808,13 +1808,13 @@ impl Default for rte_fdir_conf { unsafe { ::std::mem::zeroed() } } } -#[doc = " A structure used to enable/disable specific device interrupts."] +/// A structure used to enable/disable specific device interrupts. #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_intr_conf { - #[doc = " enable/disable lsc interrupt. 0 (default) - disable, 1 enable"] + /// enable/disable lsc interrupt. 0 (default) - disable, 1 enable pub lsc: u16, - #[doc = " enable/disable rxq interrupt. 0 (default) - disable, 1 enable"] + /// enable/disable rxq interrupt. 0 (default) - disable, 1 enable pub rxq: u16, } #[test] @@ -1855,46 +1855,46 @@ impl Clone for rte_intr_conf { *self } } -#[doc = " A structure used to configure an Ethernet port."] -#[doc = " Depending upon the RX multi-queue mode, extra advanced"] -#[doc = " configuration settings may be needed."] +/// A structure used to configure an Ethernet port. +/// Depending upon the RX multi-queue mode, extra advanced +/// configuration settings may be needed. #[repr(C)] #[derive(Copy)] pub struct rte_eth_conf { - #[doc = "< bitmap of ETH_LINK_SPEED_XXX of speeds to be"] - #[doc = "used. ETH_LINK_SPEED_FIXED disables link"] - #[doc = "autonegotiation, and a unique speed shall be"] - #[doc = "set. Otherwise, the bitmap defines the set of"] - #[doc = "speeds to be advertised. If the special value"] - #[doc = "ETH_LINK_SPEED_AUTONEG (0) is used, all speeds"] - #[doc = "supported are advertised."] + /// < bitmap of ETH_LINK_SPEED_XXX of speeds to be + /// used. ETH_LINK_SPEED_FIXED disables link + /// autonegotiation, and a unique speed shall be + /// set. Otherwise, the bitmap defines the set of + /// speeds to be advertised. If the special value + /// ETH_LINK_SPEED_AUTONEG (0) is used, all speeds + /// supported are advertised. pub link_speeds: u32, - #[doc = "< Port RX configuration."] + /// < Port RX configuration. pub rxmode: rte_eth_rxmode, - #[doc = "< Port TX configuration."] + /// < Port TX configuration. pub txmode: rte_eth_txmode, - #[doc = "< Loopback operation mode. By default the value"] - #[doc = "is 0, meaning the loopback mode is disabled."] - #[doc = "Read the datasheet of given ethernet controller"] - #[doc = "for details. The possible values of this field"] - #[doc = "are defined in implementation of each driver."] + /// < Loopback operation mode. By default the value + /// is 0, meaning the loopback mode is disabled. + /// Read the datasheet of given ethernet controller + /// for details. The possible values of this field + /// are defined in implementation of each driver. pub lpbk_mode: u32, - #[doc = "< Port RX filtering configuration (union)."] + /// < Port RX filtering configuration (union). pub rx_adv_conf: rte_eth_conf__bindgen_ty_1, - #[doc = "< Port TX DCB configuration (union)."] + /// < Port TX DCB configuration (union). pub tx_adv_conf: rte_eth_conf__bindgen_ty_2, - #[doc = " Currently,Priority Flow Control(PFC) are supported,if DCB with PFC"] - #[doc = "is needed,and the variable must be set ETH_DCB_PFC_SUPPORT."] + /// Currently,Priority Flow Control(PFC) are supported,if DCB with PFC + /// is needed,and the variable must be set ETH_DCB_PFC_SUPPORT. pub dcb_capability_en: u32, - #[doc = "< FDIR configuration."] + /// < FDIR configuration. pub fdir_conf: rte_fdir_conf, - #[doc = "< Interrupt mode configuration."] + /// < Interrupt mode configuration. pub intr_conf: rte_intr_conf, } #[repr(C)] #[derive(Copy)] pub struct rte_eth_conf__bindgen_ty_1 { - #[doc = "< Port RSS configuration"] + /// < Port RSS configuration pub rss_conf: rte_eth_rss_conf, pub vmdq_dcb_conf: rte_eth_vmdq_dcb_conf, pub dcb_rx_conf: rte_eth_dcb_rx_conf, diff --git a/tests/expectations/tests/layout_kni_mbuf.rs b/tests/expectations/tests/layout_kni_mbuf.rs index 8d233cd4..409dad17 100644 --- a/tests/expectations/tests/layout_kni_mbuf.rs +++ b/tests/expectations/tests/layout_kni_mbuf.rs @@ -15,18 +15,18 @@ pub struct rte_kni_mbuf { pub buf_addr: *mut ::std::os::raw::c_void, pub buf_physaddr: u64, pub pad0: [::std::os::raw::c_char; 2usize], - #[doc = "< Start address of data in segment buffer."] + /// < Start address of data in segment buffer. pub data_off: u16, pub pad1: [::std::os::raw::c_char; 2usize], - #[doc = "< Number of segments."] + /// < Number of segments. pub nb_segs: u8, pub pad4: [::std::os::raw::c_char; 1usize], - #[doc = "< Offload features."] + /// < Offload features. pub ol_flags: u64, pub pad2: [::std::os::raw::c_char; 4usize], - #[doc = "< Total pkt len: sum of all segment data_len."] + /// < Total pkt len: sum of all segment data_len. pub pkt_len: u32, - #[doc = "< Amount of data in segment buffer."] + /// < Amount of data in segment buffer. pub data_len: u16, pub __bindgen_padding_0: [u8; 22usize], pub pad3: [::std::os::raw::c_char; 8usize], diff --git a/tests/expectations/tests/layout_large_align_field.rs b/tests/expectations/tests/layout_large_align_field.rs index d2f33a55..599d813d 100644 --- a/tests/expectations/tests/layout_large_align_field.rs +++ b/tests/expectations/tests/layout_large_align_field.rs @@ -53,23 +53,23 @@ pub const IP_MAX_FRAG_NUM: _bindgen_ty_1 = _bindgen_ty_1::IP_MAX_FRAG_NUM; #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum _bindgen_ty_1 { - #[doc = "< index of last fragment"] + /// < index of last fragment IP_LAST_FRAG_IDX = 0, - #[doc = "< index of first fragment"] + /// < index of first fragment IP_FIRST_FRAG_IDX = 1, - #[doc = "< minimum number of fragments"] + /// < minimum number of fragments IP_MIN_FRAG_NUM = 2, IP_MAX_FRAG_NUM = 4, } -#[doc = " @internal fragmented mbuf"] +/// @internal fragmented mbuf #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ip_frag { - #[doc = "< offset into the packet"] + /// < offset into the packet pub ofs: u16, - #[doc = "< length of fragment"] + /// < length of fragment pub len: u16, - #[doc = "< fragment mbuf"] + /// < fragment mbuf pub mb: *mut rte_mbuf, } #[test] @@ -120,15 +120,15 @@ impl Default for ip_frag { unsafe { ::std::mem::zeroed() } } } -#[doc = " @internal <src addr, dst_addr, id> to uniquely indetify fragmented datagram."] +/// @internal <src addr, dst_addr, id> to uniquely indetify fragmented datagram. #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct ip_frag_key { - #[doc = "< src address, first 8 bytes used for IPv4"] + /// < src address, first 8 bytes used for IPv4 pub src_dst: [u64; 4usize], - #[doc = "< dst address"] + /// < dst address pub id: u32, - #[doc = "< src/dst key length"] + /// < src/dst key length pub key_len: u32, } #[test] @@ -174,24 +174,24 @@ fn bindgen_test_layout_ip_frag_key() { ) ); } -#[doc = " @internal Fragmented packet to reassemble."] -#[doc = " First two entries in the frags[] array are for the last and first fragments."] +/// @internal Fragmented packet to reassemble. +/// First two entries in the frags[] array are for the last and first fragments. #[repr(C)] #[derive(Copy, Clone)] pub struct ip_frag_pkt { - #[doc = "< LRU list"] + /// < LRU list pub lru: ip_frag_pkt__bindgen_ty_1, - #[doc = "< fragmentation key"] + /// < fragmentation key pub key: ip_frag_key, - #[doc = "< creation timestamp"] + /// < creation timestamp pub start: u64, - #[doc = "< expected reassembled size"] + /// < expected reassembled size pub total_size: u32, - #[doc = "< size of fragments received"] + /// < size of fragments received pub frag_size: u32, - #[doc = "< index of next entry to fill"] + /// < index of next entry to fill pub last_idx: u32, - #[doc = "< fragments"] + /// < fragments pub frags: [ip_frag; 4usize], pub __bindgen_padding_0: [u64; 6usize], } @@ -370,21 +370,21 @@ impl Default for ip_pkt_list { unsafe { ::std::mem::zeroed() } } } -#[doc = " fragmentation table statistics"] +/// fragmentation table statistics #[repr(C)] #[derive(Copy, Clone)] pub struct ip_frag_tbl_stat { - #[doc = "< total # of find/insert attempts."] + /// < total # of find/insert attempts. pub find_num: u64, - #[doc = "< # of add ops."] + /// < # of add ops. pub add_num: u64, - #[doc = "< # of del ops."] + /// < # of del ops. pub del_num: u64, - #[doc = "< # of reuse (del/add) ops."] + /// < # of reuse (del/add) ops. pub reuse_num: u64, - #[doc = "< total # of add failures."] + /// < total # of add failures. pub fail_total: u64, - #[doc = "< # of \'no space\' add failures."] + /// < # of 'no space' add failures. pub fail_nospace: u64, pub __bindgen_padding_0: [u64; 2usize], } @@ -461,31 +461,31 @@ impl Default for ip_frag_tbl_stat { unsafe { ::std::mem::zeroed() } } } -#[doc = " fragmentation table"] +/// fragmentation table #[repr(C)] pub struct rte_ip_frag_tbl { - #[doc = "< ttl for table entries."] + /// < ttl for table entries. pub max_cycles: u64, - #[doc = "< hash value mask."] + /// < hash value mask. pub entry_mask: u32, - #[doc = "< max entries allowed."] + /// < max entries allowed. pub max_entries: u32, - #[doc = "< entries in use."] + /// < entries in use. pub use_entries: u32, - #[doc = "< hash assocaitivity."] + /// < hash assocaitivity. pub bucket_entries: u32, - #[doc = "< total size of the table."] + /// < total size of the table. pub nb_entries: u32, - #[doc = "< num of associativity lines."] + /// < num of associativity lines. pub nb_buckets: u32, - #[doc = "< last used entry."] + /// < last used entry. pub last: *mut ip_frag_pkt, - #[doc = "< LRU list for table entries."] + /// < LRU list for table entries. pub lru: ip_pkt_list, pub __bindgen_padding_0: u64, - #[doc = "< statistics counters."] + /// < statistics counters. pub stat: ip_frag_tbl_stat, - #[doc = "< hash table."] + /// < hash table. pub pkt: __IncompleteArrayField<ip_frag_pkt>, } #[test] @@ -611,7 +611,7 @@ impl Default for rte_ip_frag_tbl { unsafe { ::std::mem::zeroed() } } } -#[doc = "< fragment mbuf"] +/// < fragment mbuf #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct rte_mbuf { diff --git a/tests/expectations/tests/layout_mbuf.rs b/tests/expectations/tests/layout_mbuf.rs index 78131f87..81ff60ed 100644 --- a/tests/expectations/tests/layout_mbuf.rs +++ b/tests/expectations/tests/layout_mbuf.rs @@ -95,11 +95,11 @@ pub type phys_addr_t = u64; pub type MARKER = [*mut ::std::os::raw::c_void; 0usize]; pub type MARKER8 = [u8; 0usize]; pub type MARKER64 = [u64; 0usize]; -#[doc = " The atomic counter structure."] +/// The atomic counter structure. #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct rte_atomic16_t { - #[doc = "< An internal counter value."] + /// < An internal counter value. pub cnt: i16, } #[test] @@ -125,65 +125,65 @@ fn bindgen_test_layout_rte_atomic16_t() { ) ); } -#[doc = " The generic rte_mbuf, containing a packet mbuf."] +/// The generic rte_mbuf, containing a packet mbuf. #[repr(C)] pub struct rte_mbuf { pub cacheline0: MARKER, - #[doc = "< Virtual address of segment buffer."] + /// < Virtual address of segment buffer. pub buf_addr: *mut ::std::os::raw::c_void, - #[doc = "< Physical address of segment buffer."] + /// < Physical address of segment buffer. pub buf_physaddr: phys_addr_t, - #[doc = "< Length of segment buffer."] + /// < Length of segment buffer. pub buf_len: u16, pub rearm_data: MARKER8, pub data_off: u16, pub __bindgen_anon_1: rte_mbuf__bindgen_ty_1, - #[doc = "< Number of segments."] + /// < Number of segments. pub nb_segs: u8, - #[doc = "< Input port."] + /// < Input port. pub port: u8, - #[doc = "< Offload features."] + /// < Offload features. pub ol_flags: u64, pub rx_descriptor_fields1: MARKER, pub __bindgen_anon_2: rte_mbuf__bindgen_ty_2, - #[doc = "< Total pkt len: sum of all segments."] + /// < Total pkt len: sum of all segments. pub pkt_len: u32, - #[doc = "< Amount of data in segment buffer."] + /// < Amount of data in segment buffer. pub data_len: u16, - #[doc = " VLAN TCI (CPU order), valid if PKT_RX_VLAN_STRIPPED is set."] + /// VLAN TCI (CPU order), valid if PKT_RX_VLAN_STRIPPED is set. pub vlan_tci: u16, - #[doc = "< hash information"] + /// < hash information pub hash: rte_mbuf__bindgen_ty_3, - #[doc = "< Sequence number. See also rte_reorder_insert()"] + /// < Sequence number. See also rte_reorder_insert() pub seqn: u32, - #[doc = " Outer VLAN TCI (CPU order), valid if PKT_RX_QINQ_STRIPPED is set."] + /// Outer VLAN TCI (CPU order), valid if PKT_RX_QINQ_STRIPPED is set. pub vlan_tci_outer: u16, pub cacheline1: MARKER, pub __bindgen_anon_3: rte_mbuf__bindgen_ty_4, - #[doc = "< Pool from which mbuf was allocated."] + /// < Pool from which mbuf was allocated. pub pool: *mut rte_mempool, - #[doc = "< Next segment of scattered packet."] + /// < Next segment of scattered packet. pub next: *mut rte_mbuf, pub __bindgen_anon_4: rte_mbuf__bindgen_ty_5, - #[doc = " Size of the application private data. In case of an indirect"] - #[doc = " mbuf, it stores the direct mbuf private data size."] + /// Size of the application private data. In case of an indirect + /// mbuf, it stores the direct mbuf private data size. pub priv_size: u16, - #[doc = " Timesync flags for use with IEEE1588."] + /// Timesync flags for use with IEEE1588. pub timesync: u16, pub __bindgen_padding_0: [u32; 7usize], } -#[doc = " 16-bit Reference counter."] -#[doc = " It should only be accessed using the following functions:"] -#[doc = " rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and"] -#[doc = " rte_mbuf_refcnt_set(). The functionality of these functions (atomic,"] -#[doc = " or non-atomic) is controlled by the CONFIG_RTE_MBUF_REFCNT_ATOMIC"] -#[doc = " config option."] +/// 16-bit Reference counter. +/// It should only be accessed using the following functions: +/// rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and +/// rte_mbuf_refcnt_set(). The functionality of these functions (atomic, +/// or non-atomic) is controlled by the CONFIG_RTE_MBUF_REFCNT_ATOMIC +/// config option. #[repr(C)] #[derive(Copy, Clone)] pub union rte_mbuf__bindgen_ty_1 { - #[doc = "< Atomically accessed refcnt"] + /// < Atomically accessed refcnt pub refcnt_atomic: rte_atomic16_t, - #[doc = "< Non-atomically accessed refcnt"] + /// < Non-atomically accessed refcnt pub refcnt: u16, _bindgen_union_align: u16, } @@ -230,7 +230,7 @@ impl Default for rte_mbuf__bindgen_ty_1 { #[repr(C)] #[derive(Copy, Clone)] pub union rte_mbuf__bindgen_ty_2 { - #[doc = "< L2/L3/L4 and tunnel information."] + /// < L2/L3/L4 and tunnel information. pub packet_type: u32, pub __bindgen_anon_1: rte_mbuf__bindgen_ty_2__bindgen_ty_1, _bindgen_union_align: u32, @@ -414,13 +414,13 @@ impl Default for rte_mbuf__bindgen_ty_2 { #[repr(C)] #[derive(Copy, Clone)] pub union rte_mbuf__bindgen_ty_3 { - #[doc = "< RSS hash result if RSS enabled"] + /// < RSS hash result if RSS enabled pub rss: u32, - #[doc = "< Filter identifier if FDIR enabled"] + /// < Filter identifier if FDIR enabled pub fdir: rte_mbuf__bindgen_ty_3__bindgen_ty_1, - #[doc = "< Hierarchical scheduler"] + /// < Hierarchical scheduler pub sched: rte_mbuf__bindgen_ty_3__bindgen_ty_2, - #[doc = "< User defined tags. See rte_distributor_process()"] + /// < User defined tags. See rte_distributor_process() pub usr: u32, _bindgen_union_align: [u32; 2usize], } @@ -669,9 +669,9 @@ impl Default for rte_mbuf__bindgen_ty_3 { #[repr(C)] #[derive(Copy, Clone)] pub union rte_mbuf__bindgen_ty_4 { - #[doc = "< Can be used for external metadata"] + /// < Can be used for external metadata pub userdata: *mut ::std::os::raw::c_void, - #[doc = "< Allow 8-byte userdata on 32-bit"] + /// < Allow 8-byte userdata on 32-bit pub udata64: u64, _bindgen_union_align: u64, } @@ -716,7 +716,7 @@ impl Default for rte_mbuf__bindgen_ty_4 { #[repr(C)] #[derive(Copy, Clone)] pub union rte_mbuf__bindgen_ty_5 { - #[doc = "< combined for easy fetch"] + /// < combined for easy fetch pub tx_offload: u64, pub __bindgen_anon_1: rte_mbuf__bindgen_ty_5__bindgen_ty_1, _bindgen_union_align: u64, @@ -1104,7 +1104,7 @@ impl Default for rte_mbuf { unsafe { ::std::mem::zeroed() } } } -#[doc = "< Pool from which mbuf was allocated."] +/// < Pool from which mbuf was allocated. #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct rte_mempool { diff --git a/tests/expectations/tests/layout_mbuf_1_0.rs b/tests/expectations/tests/layout_mbuf_1_0.rs index ab5126cb..f6a9eaa0 100644 --- a/tests/expectations/tests/layout_mbuf_1_0.rs +++ b/tests/expectations/tests/layout_mbuf_1_0.rs @@ -138,11 +138,11 @@ pub type phys_addr_t = u64; pub type MARKER = [*mut ::std::os::raw::c_void; 0usize]; pub type MARKER8 = [u8; 0usize]; pub type MARKER64 = [u64; 0usize]; -#[doc = " The atomic counter structure."] +/// The atomic counter structure. #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_atomic16_t { - #[doc = "< An internal counter value."] + /// < An internal counter value. pub cnt: i16, } #[test] @@ -173,65 +173,65 @@ impl Clone for rte_atomic16_t { *self } } -#[doc = " The generic rte_mbuf, containing a packet mbuf."] +/// The generic rte_mbuf, containing a packet mbuf. #[repr(C)] pub struct rte_mbuf { pub cacheline0: MARKER, - #[doc = "< Virtual address of segment buffer."] + /// < Virtual address of segment buffer. pub buf_addr: *mut ::std::os::raw::c_void, - #[doc = "< Physical address of segment buffer."] + /// < Physical address of segment buffer. pub buf_physaddr: phys_addr_t, - #[doc = "< Length of segment buffer."] + /// < Length of segment buffer. pub buf_len: u16, pub rearm_data: MARKER8, pub data_off: u16, pub __bindgen_anon_1: rte_mbuf__bindgen_ty_1, - #[doc = "< Number of segments."] + /// < Number of segments. pub nb_segs: u8, - #[doc = "< Input port."] + /// < Input port. pub port: u8, - #[doc = "< Offload features."] + /// < Offload features. pub ol_flags: u64, pub rx_descriptor_fields1: MARKER, pub __bindgen_anon_2: rte_mbuf__bindgen_ty_2, - #[doc = "< Total pkt len: sum of all segments."] + /// < Total pkt len: sum of all segments. pub pkt_len: u32, - #[doc = "< Amount of data in segment buffer."] + /// < Amount of data in segment buffer. pub data_len: u16, - #[doc = " VLAN TCI (CPU order), valid if PKT_RX_VLAN_STRIPPED is set."] + /// VLAN TCI (CPU order), valid if PKT_RX_VLAN_STRIPPED is set. pub vlan_tci: u16, - #[doc = "< hash information"] + /// < hash information pub hash: rte_mbuf__bindgen_ty_3, - #[doc = "< Sequence number. See also rte_reorder_insert()"] + /// < Sequence number. See also rte_reorder_insert() pub seqn: u32, - #[doc = " Outer VLAN TCI (CPU order), valid if PKT_RX_QINQ_STRIPPED is set."] + /// Outer VLAN TCI (CPU order), valid if PKT_RX_QINQ_STRIPPED is set. pub vlan_tci_outer: u16, pub cacheline1: MARKER, pub __bindgen_anon_3: rte_mbuf__bindgen_ty_4, - #[doc = "< Pool from which mbuf was allocated."] + /// < Pool from which mbuf was allocated. pub pool: *mut rte_mempool, - #[doc = "< Next segment of scattered packet."] + /// < Next segment of scattered packet. pub next: *mut rte_mbuf, pub __bindgen_anon_4: rte_mbuf__bindgen_ty_5, - #[doc = " Size of the application private data. In case of an indirect"] - #[doc = " mbuf, it stores the direct mbuf private data size."] + /// Size of the application private data. In case of an indirect + /// mbuf, it stores the direct mbuf private data size. pub priv_size: u16, - #[doc = " Timesync flags for use with IEEE1588."] + /// Timesync flags for use with IEEE1588. pub timesync: u16, pub __bindgen_padding_0: [u32; 7usize], } -#[doc = " 16-bit Reference counter."] -#[doc = " It should only be accessed using the following functions:"] -#[doc = " rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and"] -#[doc = " rte_mbuf_refcnt_set(). The functionality of these functions (atomic,"] -#[doc = " or non-atomic) is controlled by the CONFIG_RTE_MBUF_REFCNT_ATOMIC"] -#[doc = " config option."] +/// 16-bit Reference counter. +/// It should only be accessed using the following functions: +/// rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and +/// rte_mbuf_refcnt_set(). The functionality of these functions (atomic, +/// or non-atomic) is controlled by the CONFIG_RTE_MBUF_REFCNT_ATOMIC +/// config option. #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_mbuf__bindgen_ty_1 { - #[doc = "< Atomically accessed refcnt"] + /// < Atomically accessed refcnt pub refcnt_atomic: __BindgenUnionField<rte_atomic16_t>, - #[doc = "< Non-atomically accessed refcnt"] + /// < Non-atomically accessed refcnt pub refcnt: __BindgenUnionField<u16>, pub bindgen_union_field: u16, } @@ -278,7 +278,7 @@ impl Clone for rte_mbuf__bindgen_ty_1 { #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_mbuf__bindgen_ty_2 { - #[doc = "< L2/L3/L4 and tunnel information."] + /// < L2/L3/L4 and tunnel information. pub packet_type: __BindgenUnionField<u32>, pub __bindgen_anon_1: __BindgenUnionField<rte_mbuf__bindgen_ty_2__bindgen_ty_1>, pub bindgen_union_field: u32, @@ -467,13 +467,13 @@ impl Clone for rte_mbuf__bindgen_ty_2 { #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_mbuf__bindgen_ty_3 { - #[doc = "< RSS hash result if RSS enabled"] + /// < RSS hash result if RSS enabled pub rss: __BindgenUnionField<u32>, - #[doc = "< Filter identifier if FDIR enabled"] + /// < Filter identifier if FDIR enabled pub fdir: __BindgenUnionField<rte_mbuf__bindgen_ty_3__bindgen_ty_1>, - #[doc = "< Hierarchical scheduler"] + /// < Hierarchical scheduler pub sched: __BindgenUnionField<rte_mbuf__bindgen_ty_3__bindgen_ty_2>, - #[doc = "< User defined tags. See rte_distributor_process()"] + /// < User defined tags. See rte_distributor_process() pub usr: __BindgenUnionField<u32>, pub bindgen_union_field: [u32; 2usize], } @@ -733,9 +733,9 @@ impl Clone for rte_mbuf__bindgen_ty_3 { #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_mbuf__bindgen_ty_4 { - #[doc = "< Can be used for external metadata"] + /// < Can be used for external metadata pub userdata: __BindgenUnionField<*mut ::std::os::raw::c_void>, - #[doc = "< Allow 8-byte userdata on 32-bit"] + /// < Allow 8-byte userdata on 32-bit pub udata64: __BindgenUnionField<u64>, pub bindgen_union_field: u64, } @@ -780,7 +780,7 @@ impl Clone for rte_mbuf__bindgen_ty_4 { #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_mbuf__bindgen_ty_5 { - #[doc = "< combined for easy fetch"] + /// < combined for easy fetch pub tx_offload: __BindgenUnionField<u64>, pub __bindgen_anon_1: __BindgenUnionField<rte_mbuf__bindgen_ty_5__bindgen_ty_1>, pub bindgen_union_field: u64, @@ -1173,7 +1173,7 @@ impl Default for rte_mbuf { unsafe { ::std::mem::zeroed() } } } -#[doc = "< Pool from which mbuf was allocated."] +/// < Pool from which mbuf was allocated. #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_mempool { diff --git a/tests/expectations/tests/libclang-3.8/type_alias_template_specialized.rs b/tests/expectations/tests/libclang-3.8/type_alias_template_specialized.rs index 9c972a18..a0d9ade6 100644 --- a/tests/expectations/tests/libclang-3.8/type_alias_template_specialized.rs +++ b/tests/expectations/tests/libclang-3.8/type_alias_template_specialized.rs @@ -32,5 +32,5 @@ fn bindgen_test_layout_Rooted() { ) ); } -#[doc = " <div rustbindgen replaces=\"MaybeWrapped\"></div>"] +/// <div rustbindgen replaces="MaybeWrapped"></div> pub type MaybeWrapped<a> = a; diff --git a/tests/expectations/tests/libclang-3.9/type_alias_template_specialized.rs b/tests/expectations/tests/libclang-3.9/type_alias_template_specialized.rs index 9c972a18..a0d9ade6 100644 --- a/tests/expectations/tests/libclang-3.9/type_alias_template_specialized.rs +++ b/tests/expectations/tests/libclang-3.9/type_alias_template_specialized.rs @@ -32,5 +32,5 @@ fn bindgen_test_layout_Rooted() { ) ); } -#[doc = " <div rustbindgen replaces=\"MaybeWrapped\"></div>"] +/// <div rustbindgen replaces="MaybeWrapped"></div> pub type MaybeWrapped<a> = a; diff --git a/tests/expectations/tests/libclang-4/type_alias_template_specialized.rs b/tests/expectations/tests/libclang-4/type_alias_template_specialized.rs index bd10e1b3..a09323a8 100644 --- a/tests/expectations/tests/libclang-4/type_alias_template_specialized.rs +++ b/tests/expectations/tests/libclang-4/type_alias_template_specialized.rs @@ -37,7 +37,7 @@ impl Default for Rooted { unsafe { ::std::mem::zeroed() } } } -#[doc = " <div rustbindgen replaces=\"MaybeWrapped\"></div>"] +/// <div rustbindgen replaces="MaybeWrapped"></div> pub type MaybeWrapped<a> = a; #[test] fn __bindgen_test_layout_MaybeWrapped_open0_int_close0_instantiation() { diff --git a/tests/expectations/tests/libclang-5/type_alias_template_specialized.rs b/tests/expectations/tests/libclang-5/type_alias_template_specialized.rs index 851dc4e1..89e37fe8 100644 --- a/tests/expectations/tests/libclang-5/type_alias_template_specialized.rs +++ b/tests/expectations/tests/libclang-5/type_alias_template_specialized.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -35,7 +40,7 @@ impl Default for Rooted { unsafe { ::std::mem::zeroed() } } } -#[doc = " <div rustbindgen replaces=\"MaybeWrapped\"></div>"] +/// <div rustbindgen replaces="MaybeWrapped"></div> pub type MaybeWrapped<a> = a; #[test] fn __bindgen_test_layout_MaybeWrapped_open0_int_close0_instantiation() { diff --git a/tests/expectations/tests/no-derive-debug.rs b/tests/expectations/tests/no-derive-debug.rs index e353fa5f..f5e724d0 100644 --- a/tests/expectations/tests/no-derive-debug.rs +++ b/tests/expectations/tests/no-derive-debug.rs @@ -13,9 +13,9 @@ pub struct foo { bar: ::std::os::raw::c_int, } -#[doc = " bar should compile. It will normally derive debug, but our blacklist of foo"] -#[doc = " and replacement for another type that doesn\'t implement it would prevent it"] -#[doc = " from building if --no-derive-debug didn\'t work."] +/// bar should compile. It will normally derive debug, but our blacklist of foo +/// and replacement for another type that doesn't implement it would prevent it +/// from building if --no-derive-debug didn't work. #[repr(C)] pub struct bar { pub foo: foo, diff --git a/tests/expectations/tests/no-derive-default.rs b/tests/expectations/tests/no-derive-default.rs index 9e14693f..cbf46c74 100644 --- a/tests/expectations/tests/no-derive-default.rs +++ b/tests/expectations/tests/no-derive-default.rs @@ -13,9 +13,9 @@ pub struct foo { bar: ::std::os::raw::c_int, } -#[doc = " bar should compile. It will normally derive default, but our blacklist of foo"] -#[doc = " and replacement for another type that doesn\'t implement it would prevent it"] -#[doc = " from building if --no-derive-default didn\'t work."] +/// bar should compile. It will normally derive default, but our blacklist of foo +/// and replacement for another type that doesn't implement it would prevent it +/// from building if --no-derive-default didn't work. #[repr(C)] pub struct bar { pub foo: foo, diff --git a/tests/expectations/tests/no_copy.rs b/tests/expectations/tests/no_copy.rs index 96fd542c..a61b457e 100644 --- a/tests/expectations/tests/no_copy.rs +++ b/tests/expectations/tests/no_copy.rs @@ -1,8 +1,13 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] -#[doc = " <div rustbindgen nocopy></div>"] +/// <div rustbindgen nocopy></div> #[repr(C)] #[derive(Debug, Default)] pub struct CopiableButWait { diff --git a/tests/expectations/tests/opaque-template-inst-member-2.rs b/tests/expectations/tests/opaque-template-inst-member-2.rs index 0245a1ae..b5afc667 100644 --- a/tests/expectations/tests/opaque-template-inst-member-2.rs +++ b/tests/expectations/tests/opaque-template-inst-member-2.rs @@ -7,14 +7,14 @@ non_upper_case_globals )] -#[doc = " This is like `opaque-template-inst-member.hpp` except exercising the cases"] -#[doc = " where we are OK to derive Debug/Hash/PartialEq."] +/// This is like `opaque-template-inst-member.hpp` except exercising the cases +/// where we are OK to derive Debug/Hash/PartialEq. #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct OpaqueTemplate { pub _address: u8, } -#[doc = " Should derive Debug/Hash/PartialEq."] +/// Should derive Debug/Hash/PartialEq. #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct ContainsOpaqueTemplate { @@ -54,7 +54,7 @@ fn bindgen_test_layout_ContainsOpaqueTemplate() { ) ); } -#[doc = " Should also derive Debug/Hash/PartialEq."] +/// Should also derive Debug/Hash/PartialEq. #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct InheritsOpaqueTemplate { diff --git a/tests/expectations/tests/opaque-template-inst-member.rs b/tests/expectations/tests/opaque-template-inst-member.rs index 4c5af91f..87e98daf 100644 --- a/tests/expectations/tests/opaque-template-inst-member.rs +++ b/tests/expectations/tests/opaque-template-inst-member.rs @@ -12,8 +12,8 @@ pub struct OpaqueTemplate { pub _address: u8, } -#[doc = " This should not end up deriving Debug/Hash because its `mBlah` field cannot derive"] -#[doc = " Debug/Hash because the instantiation\'s definition cannot derive Debug/Hash."] +/// This should not end up deriving Debug/Hash because its `mBlah` field cannot derive +/// Debug/Hash because the instantiation's definition cannot derive Debug/Hash. #[repr(C)] pub struct ContainsOpaqueTemplate { pub mBlah: [u32; 101usize], @@ -62,8 +62,8 @@ impl ::std::cmp::PartialEq for ContainsOpaqueTemplate { &self.mBlah[..] == &other.mBlah[..] && self.mBaz == other.mBaz } } -#[doc = " This should not end up deriving Debug/Hash either, for similar reasons, although"] -#[doc = " we\'re exercising base member edges now."] +/// This should not end up deriving Debug/Hash either, for similar reasons, although +/// we're exercising base member edges now. #[repr(C)] pub struct InheritsOpaqueTemplate { pub _base: [u8; 401usize], diff --git a/tests/expectations/tests/opaque_in_struct.rs b/tests/expectations/tests/opaque_in_struct.rs index 650edf68..590c5fdc 100644 --- a/tests/expectations/tests/opaque_in_struct.rs +++ b/tests/expectations/tests/opaque_in_struct.rs @@ -1,8 +1,13 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] -#[doc = " <div rustbindgen opaque>"] +/// <div rustbindgen opaque> #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct opaque { diff --git a/tests/expectations/tests/opaque_pointer.rs b/tests/expectations/tests/opaque_pointer.rs index 9dbce043..c44a2440 100644 --- a/tests/expectations/tests/opaque_pointer.rs +++ b/tests/expectations/tests/opaque_pointer.rs @@ -1,8 +1,13 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] -#[doc = " <div rustbindgen opaque></div>"] +/// <div rustbindgen opaque></div> #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct OtherOpaque { @@ -21,7 +26,7 @@ fn bindgen_test_layout_OtherOpaque() { concat!("Alignment of ", stringify!(OtherOpaque)) ); } -#[doc = " <div rustbindgen opaque></div>"] +/// <div rustbindgen opaque></div> #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct Opaque { diff --git a/tests/expectations/tests/opaque_typedef.rs b/tests/expectations/tests/opaque_typedef.rs index 3f9defd3..75b79f20 100644 --- a/tests/expectations/tests/opaque_typedef.rs +++ b/tests/expectations/tests/opaque_typedef.rs @@ -1,12 +1,17 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct RandomTemplate { pub _address: u8, } -#[doc = " <div rustbindgen opaque></div>"] +/// <div rustbindgen opaque></div> pub type ShouldBeOpaque = u8; pub type ShouldNotBeOpaque = RandomTemplate; diff --git a/tests/expectations/tests/private.rs b/tests/expectations/tests/private.rs index 3329067c..5088d9c9 100644 --- a/tests/expectations/tests/private.rs +++ b/tests/expectations/tests/private.rs @@ -1,12 +1,17 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct HasPrivate { pub mNotPrivate: ::std::os::raw::c_int, - #[doc = " <div rustbindgen private></div>"] + /// <div rustbindgen private></div> mIsPrivate: ::std::os::raw::c_int, } #[test] @@ -42,7 +47,7 @@ fn bindgen_test_layout_HasPrivate() { ) ); } -#[doc = " <div rustbindgen private></div>"] +/// <div rustbindgen private></div> #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct VeryPrivate { @@ -82,11 +87,11 @@ fn bindgen_test_layout_VeryPrivate() { ) ); } -#[doc = " <div rustbindgen private></div>"] +/// <div rustbindgen private></div> #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct ContradictPrivate { - #[doc = " <div rustbindgen private=\"false\"></div>"] + /// <div rustbindgen private="false"></div> pub mNotPrivate: ::std::os::raw::c_int, mIsPrivate: ::std::os::raw::c_int, } diff --git a/tests/expectations/tests/reparented_replacement.rs b/tests/expectations/tests/reparented_replacement.rs index 374f2d4b..8fc38cd7 100644 --- a/tests/expectations/tests/reparented_replacement.rs +++ b/tests/expectations/tests/reparented_replacement.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { @@ -9,7 +14,7 @@ pub mod root { pub mod foo { #[allow(unused_imports)] use self::super::super::root; - #[doc = " <div rustbindgen replaces=\"foo::Bar\"></div>"] + /// <div rustbindgen replaces="foo::Bar"></div> #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Bar { diff --git a/tests/expectations/tests/replace_template_alias.rs b/tests/expectations/tests/replace_template_alias.rs index c82e8b6d..853ec092 100644 --- a/tests/expectations/tests/replace_template_alias.rs +++ b/tests/expectations/tests/replace_template_alias.rs @@ -7,9 +7,9 @@ non_upper_case_globals )] -#[doc = " But the replacement type does use T!"] -#[doc = ""] -#[doc = " <div rustbindgen replaces=\"JS::detail::MaybeWrapped\" />"] +/// But the replacement type does use T! +/// +/// <div rustbindgen replaces="JS::detail::MaybeWrapped" /> pub type JS_detail_MaybeWrapped<T> = T; #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/replace_use.rs b/tests/expectations/tests/replace_use.rs index c188c27e..d8223031 100644 --- a/tests/expectations/tests/replace_use.rs +++ b/tests/expectations/tests/replace_use.rs @@ -1,8 +1,13 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] -#[doc = " <div rustbindgen replaces=\"nsTArray\"></div>"] +/// <div rustbindgen replaces="nsTArray"></div> #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct nsTArray { diff --git a/tests/expectations/tests/replaces_double.rs b/tests/expectations/tests/replaces_double.rs index 381e17e7..dae55a13 100644 --- a/tests/expectations/tests/replaces_double.rs +++ b/tests/expectations/tests/replaces_double.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -20,7 +25,7 @@ pub struct Rooted<T> { pub ptr: Rooted_MaybeWrapped<T>, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, } -#[doc = " <div rustbindgen replaces=\"Rooted_MaybeWrapped\"></div>"] +/// <div rustbindgen replaces="Rooted_MaybeWrapped"></div> pub type Rooted_MaybeWrapped<T> = T; impl<T> Default for Rooted<T> { fn default() -> Self { diff --git a/tests/expectations/tests/template.rs b/tests/expectations/tests/template.rs index a3d7122c..c0152972 100644 --- a/tests/expectations/tests/template.rs +++ b/tests/expectations/tests/template.rs @@ -331,7 +331,7 @@ impl Default for PODButContainsDtor { unsafe { ::std::mem::zeroed() } } } -#[doc = " <div rustbindgen opaque>"] +/// <div rustbindgen opaque> #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct Opaque { @@ -365,7 +365,7 @@ fn bindgen_test_layout_POD() { ) ); } -#[doc = " <div rustbindgen replaces=\"NestedReplaced\"></div>"] +/// <div rustbindgen replaces="NestedReplaced"></div> #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct NestedReplaced<T> { @@ -435,10 +435,10 @@ fn bindgen_test_layout_Untemplated() { pub struct Templated { pub m_untemplated: Untemplated, } -#[doc = " If the replacement doesn\'t happen at the parse level the container would be"] -#[doc = " copy and the replacement wouldn\'t, so this wouldn\'t compile."] -#[doc = ""] -#[doc = " <div rustbindgen replaces=\"ReplacedWithoutDestructor\"></div>"] +/// If the replacement doesn't happen at the parse level the container would be +/// copy and the replacement wouldn't, so this wouldn't compile. +/// +/// <div rustbindgen replaces="ReplacedWithoutDestructor"></div> #[repr(C)] #[derive(Debug, Hash, PartialEq, Eq)] pub struct ReplacedWithoutDestructor<T> { @@ -472,10 +472,10 @@ impl<U> Default for ShouldNotBeCopiableAsWell<U> { unsafe { ::std::mem::zeroed() } } } -#[doc = " If the replacement doesn\'t happen at the parse level the container would be"] -#[doc = " copy and the replacement wouldn\'t, so this wouldn\'t compile."] -#[doc = ""] -#[doc = " <div rustbindgen replaces=\"ReplacedWithoutDestructorFwd\"></div>"] +/// If the replacement doesn't happen at the parse level the container would be +/// copy and the replacement wouldn't, so this wouldn't compile. +/// +/// <div rustbindgen replaces="ReplacedWithoutDestructorFwd"></div> #[repr(C)] #[derive(Debug, Hash, PartialEq, Eq)] pub struct ReplacedWithoutDestructorFwd<T> { diff --git a/tests/expectations/tests/templatized-bitfield.rs b/tests/expectations/tests/templatized-bitfield.rs index 239cc9a0..15785116 100644 --- a/tests/expectations/tests/templatized-bitfield.rs +++ b/tests/expectations/tests/templatized-bitfield.rs @@ -7,9 +7,9 @@ non_upper_case_globals )] -#[doc = " We don\'t get a layout for this bitfield, since we don\'t know what `T` will"] -#[doc = " be, so we cannot allocate bitfield units. The best thing we can do is make"] -#[doc = " the struct opaque."] +/// We don't get a layout for this bitfield, since we don't know what `T` will +/// be, so we cannot allocate bitfield units. The best thing we can do is make +/// the struct opaque. #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct TemplatizedBitfield { diff --git a/tests/expectations/tests/zero-sized-array.rs b/tests/expectations/tests/zero-sized-array.rs index 04788c0b..4464bb4b 100644 --- a/tests/expectations/tests/zero-sized-array.rs +++ b/tests/expectations/tests/zero-sized-array.rs @@ -44,7 +44,7 @@ impl<T> ::std::clone::Clone for __IncompleteArrayField<T> { } } impl<T> ::std::marker::Copy for __IncompleteArrayField<T> {} -#[doc = " Bizarrely enough, this should *not* get an `_address` field."] +/// Bizarrely enough, this should *not* get an `_address` field. #[repr(C)] #[derive(Debug, Default)] pub struct ZeroSizedArray { @@ -73,7 +73,7 @@ fn bindgen_test_layout_ZeroSizedArray() { ) ); } -#[doc = " And nor should this get an `_address` field."] +/// And nor should this get an `_address` field. #[repr(C)] #[derive(Debug, Default)] pub struct ContainsZeroSizedArray { @@ -102,8 +102,8 @@ fn bindgen_test_layout_ContainsZeroSizedArray() { ) ); } -#[doc = " Inheriting from ZeroSizedArray shouldn\'t cause an `_address` to be inserted"] -#[doc = " either."] +/// Inheriting from ZeroSizedArray shouldn't cause an `_address` to be inserted +/// either. #[repr(C)] #[derive(Debug, Default)] pub struct InheritsZeroSizedArray { @@ -122,7 +122,7 @@ fn bindgen_test_layout_InheritsZeroSizedArray() { concat!("Alignment of ", stringify!(InheritsZeroSizedArray)) ); } -#[doc = " And this should not get an `_address` field either."] +/// And this should not get an `_address` field either. #[repr(C, packed)] #[derive(Debug, Default)] pub struct DynamicallySizedArray { @@ -141,7 +141,7 @@ fn bindgen_test_layout_DynamicallySizedArray() { concat!("Alignment of ", stringify!(DynamicallySizedArray)) ); } -#[doc = " No `_address` field here either."] +/// No `_address` field here either. #[repr(C)] #[derive(Debug, Default)] pub struct ContainsDynamicallySizedArray { diff --git a/tests/rustfmt.toml b/tests/rustfmt.toml index 80a6663b..e8bb3d9a 100644 --- a/tests/rustfmt.toml +++ b/tests/rustfmt.toml @@ -1 +1 @@ -# Intentionally left blank. +normalize_doc_attributes = true |