File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
crates/stackable-versioned-macros/src Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -618,6 +618,37 @@ mod utils;
618618/// ```
619619/// </details>
620620///
621+ /// ## Additional Arguments
622+ ///
623+ /// In addition to the field actions, the following top-level field arguments
624+ /// are available:
625+ ///
626+ /// ### Hinting Wrapper Types
627+ ///
628+ /// With `#[versioned(hint(...))]` it is possible to give hints to the macro
629+ /// that the field contains a wrapped type. Currently, these following hints
630+ /// are supported:
631+ ///
632+ /// - `hint(option)`: Indicates that the field contains an `Option<T>`.
633+ /// - `hint(vec)`: Indicates that the field contains a `Vec<T>`.
634+ ///
635+ /// These hints are especially useful for generated conversion functions. With
636+ /// these hints in place, the types are correctly mapped using `Into::into`
637+ /// (assuming the necessary `From` trait methods are implemented on the target
638+ /// types for the conversion to be done correctly).
639+ ///
640+ /// ```
641+ /// # use stackable_versioned_macros::versioned;
642+ /// #[versioned(version(name = "v1alpha1"), version(name = "v1beta1"))]
643+ /// mod versioned {
644+ /// pub struct Foo {
645+ /// #[versioned(changed(since = "v1beta1", from_type = "Vec<usize>"), hint(vec))]
646+ /// bar: Vec<usize>,
647+ /// baz: bool,
648+ /// }
649+ /// }
650+ /// ```
651+ ///
621652/// # Generated Helpers
622653///
623654/// This macro generates a few different helpers to enable different operations
You can’t perform that action at this time.
0 commit comments