Skip to content

Commit c320e8e

Browse files
chore: Apply suggestions
Co-authored-by: Nick <[email protected]>
1 parent 9a0b634 commit c320e8e

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

crates/stackable-versioned-macros/src/attrs/common/item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ fn default_default_fn() -> SpannedValue<Path> {
318318
)
319319
}
320320

321-
// TODO (@Techassi): Add validation for when from_name AND from_type or both
321+
// TODO (@Techassi): Add validation for when from_name AND from_type are both
322322
// none => is this action needed in the first place?
323323
// TODO (@Techassi): Add validation that the from_name mustn't include the
324324
// deprecated prefix.

crates/stackable-versioned-macros/src/lib.rs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,21 @@ mod consts;
2222
/// ## Declaring Versions
2323
///
2424
/// It is **important** to note that this macro must be placed before any other
25-
/// (derive) macros and attributes. This ensures that the macros and attributes
26-
/// are applied to the generated versioned instances of the struct or enum.
25+
/// (derive) macros and attributes. Macros supplied before the versioned macro
26+
/// will be erased, because the original struct or enum (container) is erased,
27+
/// and new containers are generated. This ensures that the macros and
28+
/// attributes are applied to the generated versioned instances of the
29+
/// container.
2730
///
2831
/// Before any of the fields or variants can be versioned, versions need to be
2932
/// declared at the container level. Each version currently supports two
3033
/// parameters: `name` and the `deprecated` flag. The `name` must be a valid
31-
/// (and supported) format - currently, only Kubernetes API versions are
32-
/// supported. The macro checks each declared version and reports any error
33-
/// encountered during parsing.
34+
/// (and supported) format.
35+
///
36+
/// <div class="warning">
37+
/// Currently, only Kubernetes API versions are supported. The macro checks each
38+
/// declared version and reports any error encountered during parsing.
39+
/// </div>
3440
///
3541
/// ```
3642
/// # use stackable_versioned_macros::versioned;
@@ -46,9 +52,9 @@ mod consts;
4652
/// 1. The `#[automatically_derived]` attribute indicates that the following
4753
/// piece of code is automatically generated by a macro instead of being
4854
/// handwritten by a developer. This information is used by cargo and rustc.
49-
/// 2. For each declared version, a new module containing the struct or enum
50-
/// (container) is generated. This enables you to reference the container by
51-
/// versions via `v1alpha1::Foo`.
55+
/// 2. For each declared version, a new module containing the container is
56+
/// generated. This enables you to reference the container by versions via
57+
/// `v1alpha1::Foo`.
5258
/// 3. This `use` statement gives the generated containers access to the imports
5359
/// at the top of the file. This is a convenience, because otherwise you
5460
/// would need to prefix used items with `super::`. Additionally, other
@@ -117,8 +123,8 @@ mod consts;
117123
///
118124
/// ## Item Actions
119125
///
120-
/// This library currently supports three different item actions. Items can
121-
/// be added, renamed and deprecated. The macro ensures that these actions
126+
/// This crate currently supports three different item actions. Items can
127+
/// be added, changed, and deprecated. The macro ensures that these actions
122128
/// adhere to the following set of rules:
123129
///
124130
/// 1. Items cannot be added and deprecated in the same version.
@@ -366,15 +372,15 @@ mod consts;
366372
/// automatically generates `From` implementations. On a high level, code
367373
/// generated for two versions _a_ and _b_, with _a < b_ looks like this:
368374
/// `impl From<a> for b`. As you can see, only upgrading is currently supported.
369-
/// Downgrading, so going from a higher version to a lower one, is not supported
370-
/// at the moment.
375+
/// Downgrading from a higher version to a lower one is not supported at the
376+
/// moment.
371377
///
372378
/// This automatic generation can be skipped to for example enable a custom
373379
/// implementation for more complex conversions.
374380
///
375381
/// ### Skipping at the Container Level
376382
///
377-
/// Disabling this feature on the container level results in no `From`
383+
/// Disabling this behavior at the container level results in no `From`
378384
/// implementation for all versions.
379385
///
380386
/// ```
@@ -397,7 +403,7 @@ mod consts;
397403
///
398404
/// ### Skipping at the Version Level
399405
///
400-
/// Disabling this feature at the version level results in no `From`
406+
/// Disabling this behavior at the version level results in no `From`
401407
/// implementation for that particular version. This can be read as "skip
402408
/// generation for converting _this_ version to the next one". In the example
403409
/// below no conversion between version `v1beta1` and `v1` is generated.

0 commit comments

Comments
 (0)