diff --git a/crates/stackable-versioned-macros/src/lib.rs b/crates/stackable-versioned-macros/src/lib.rs index 50476e713..1266615e5 100644 --- a/crates/stackable-versioned-macros/src/lib.rs +++ b/crates/stackable-versioned-macros/src/lib.rs @@ -618,6 +618,37 @@ mod utils; /// ``` /// /// +/// ## Additional Arguments +/// +/// In addition to the field actions, the following top-level field arguments +/// are available: +/// +/// ### Hinting Wrapper Types +/// +/// With `#[versioned(hint(...))]` it is possible to give hints to the macro +/// that the field contains a wrapped type. Currently, these following hints +/// are supported: +/// +/// - `hint(option)`: Indicates that the field contains an `Option`. +/// - `hint(vec)`: Indicates that the field contains a `Vec`. +/// +/// These hints are especially useful for generated conversion functions. With +/// these hints in place, the types are correctly mapped using `Into::into` +/// (assuming the necessary `From` trait methods are implemented on the target +/// types for the conversion to be done correctly). +/// +/// ``` +/// # use stackable_versioned_macros::versioned; +/// #[versioned(version(name = "v1alpha1"), version(name = "v1beta1"))] +/// mod versioned { +/// pub struct Foo { +/// #[versioned(changed(since = "v1beta1", from_type = "Vec"), hint(vec))] +/// bar: Vec, +/// baz: bool, +/// } +/// } +/// ``` +/// /// # Generated Helpers /// /// This macro generates a few different helpers to enable different operations