diff --git a/helper_crates/const-field-offset/macro/macro.rs b/helper_crates/const-field-offset/macro/macro.rs index fd92334dd..628fd799c 100644 --- a/helper_crates/const-field-offset/macro/macro.rs +++ b/helper_crates/const-field-offset/macro/macro.rs @@ -67,7 +67,7 @@ assert_eq!(FOO.get_byte_offset(), 4); )] /** -## limitations +## Limitations Only work with named #[repr(C)] structures. @@ -95,23 +95,6 @@ let pin_box = Box::pin(Foo{field_1: 1, field_2: 2}); assert_eq!(*FIELD_2.apply_pin(pin_box.as_ref()), 2); ``` -### `const-field-offset` - -In case the `const-field-offset` crate is re-exported, it is possible to -specify the crate name using the `const_field_offset` attribute. - -```rust -// suppose you re-export the const_field_offset create from a different module -mod xxx { pub use const_field_offset as cfo; } -#[repr(C)] -#[derive(xxx::cfo::FieldOffsets)] -#[const_field_offset(xxx::cfo)] -struct Foo { - field_1 : u8, - field_2 : u32, -} -``` - ### `pin_drop` This attribute works like the `pin` attribute but it does not prevent a custom @@ -138,6 +121,23 @@ impl PinnedDrop for Foo { } ``` +### `const-field-offset` + +In case the `const-field-offset` crate is re-exported, it is possible to +specify the crate name using the `const_field_offset` attribute. + +```rust +// suppose you re-export the const_field_offset create from a different module +mod xxx { pub use const_field_offset as cfo; } +#[repr(C)] +#[derive(xxx::cfo::FieldOffsets)] +#[const_field_offset(xxx::cfo)] +struct Foo { + field_1 : u8, + field_2 : u32, +} +``` + */ #[proc_macro_derive(FieldOffsets, attributes(const_field_offset, pin, pin_drop))] pub fn const_field_offset(input: TokenStream) -> TokenStream { diff --git a/helper_crates/const-field-offset/src/lib.rs b/helper_crates/const-field-offset/src/lib.rs index 7f388dac5..272d5f80a 100644 --- a/helper_crates/const-field-offset/src/lib.rs +++ b/helper_crates/const-field-offset/src/lib.rs @@ -1,3 +1,10 @@ +/*! +This crate expose the `FieldOffsets` derive macro, and the required. + +It allows to get const FieldOffset for member of a `#[repr(C)]` struct. + +The `FieldOffset` type is re-exported from the `field-offset` crate. +*/ #![no_std] #[cfg(test)] diff --git a/helper_crates/vtable/src/lib.rs b/helper_crates/vtable/src/lib.rs index 3a3fca105..a72dc1d53 100644 --- a/helper_crates/vtable/src/lib.rs +++ b/helper_crates/vtable/src/lib.rs @@ -64,6 +64,7 @@ that `cbindgen` can see the actual vtable. */ +#[doc(no_inline)] pub use const_field_offset::*; use core::marker::PhantomData; use core::ops::{Deref, DerefMut, Drop};