@@ -261,6 +261,75 @@ mod utils;
261261/// }
262262/// ```
263263///
264+ /// ### Re-emitting and merging Submodules
265+ ///
266+ /// Modules defined in the versioned module will be re-emitted. This allows for
267+ /// composition of re-exports to compose easier to use imports for downstream
268+ /// consumers of versioned containers. The following rules apply:
269+ ///
270+ /// 1. Only modules named the same like defined versions will be re-emitted.
271+ /// Modules named differently will be ignored and won't produce any code. In
272+ /// the future, this might return an error instead.
273+ /// 2. Only `use` statements defined in the module will be emitted. Other items
274+ /// will be ignored and won't produce any code. In the future, this might
275+ /// return an error instead.
276+ ///
277+ /// ```
278+ /// # use stackable_versioned_macros::versioned;
279+ /// # mod a {
280+ /// # pub mod v1alpha1 {}
281+ /// # }
282+ /// # mod b {
283+ /// # pub mod v1alpha1 {}
284+ /// # }
285+ /// #[versioned(
286+ /// version(name = "v1alpha1"),
287+ /// version(name = "v1")
288+ /// )]
289+ /// mod versioned {
290+ /// mod v1alpha1 {
291+ /// pub use a::v1alpha1::*;
292+ /// pub use b::v1alpha1::*;
293+ /// }
294+ ///
295+ /// struct Foo {
296+ /// bar: usize,
297+ /// }
298+ /// }
299+ /// # fn main() {}
300+ /// ```
301+ ///
302+ /// <details>
303+ /// <summary>Expand Generated Code</summary>
304+ ///
305+ /// ```ignore
306+ /// mod v1alpha1 {
307+ /// use super::*;
308+ /// pub use a::v1alpha1::*;
309+ /// pub use b::v1alpha1::*;
310+ /// pub struct Foo {
311+ /// pub bar: usize,
312+ /// }
313+ /// }
314+ ///
315+ /// impl ::std::convert::From<v1alpha1::Foo> for v1::Foo {
316+ /// fn from(__sv_foo: v1alpha1::Foo) -> Self {
317+ /// Self {
318+ /// bar: __sv_foo.bar.into(),
319+ /// }
320+ /// }
321+ /// }
322+ ///
323+ /// mod v1 {
324+ /// use super::*;
325+ /// pub struct Foo {
326+ /// pub bar: usize,
327+ /// }
328+ /// }
329+ /// ```
330+ ///
331+ /// </details>
332+ ///
264333/// ## Item Actions
265334///
266335/// This crate currently supports three different item actions. Items can
0 commit comments