[stacked] Add docs to inventory code#864
Conversation
joshwlewis
left a comment
There was a problem hiding this comment.
Works for me. What do you think about merging this to your PR @runesoerensen.
|
Makes sense to merge the changes into the other branch! I've added a few comments, but this branch should also be updated to use the new feature flags (and replace the TODO in the comments). |
I also suggest we change the name of `inventory/version` to `inventory/artifact_requirement.rs` or `requirement.rs`.
Co-authored-by: Rune Soerensen <rsoerensen@salesforce.com>
ebac8c0 to
a981572
Compare
|
Updated with the latest features. Leaving the merge up to you. |
|
I've updated the example usage docs in |
|
@runesoerensen thanks. I like that the example also now gives a sample of what the resulting inventory.toml format will look like. I added a line that shows how to Given all of that, I think what we've got is pretty great. Take a look at my commit and either merge or comment. |
* Add src files from inventory repo Copy all files currently living in https://github.com/Malax/inventory/tree/main/inventory/src without any changes. Co-Authored-By: Manuel Fuchs <manuel.fuchs@salesforce.com> Co-Authored-By: Josh W Lewis <josh.lewis@salesforce.com> * Merge lib.rs and inventory.rs * Declare inventory module and feature * Prefer PhantomData * Add must_use attribute * Remove unused import * Allow unwrap for now * Add sha2 feature We may want to consider another approach here (e.g. naming the feature `inventory-sha2` and/or pulling in the inventory dependency ["inventory", "dep:sha2"]). While the crate will be pulled in if a user enables the `sha2`, the inventory-specific sha2 code won't be compiled unless the `inventory` feature is also enabled. * Add semver feature * Include patch version in dependency requirements * Add inventory toml dependency * Add inventory thiserror dependency * Add changelog entry * Allow unreachable pub for re-exports Also see Malax/inventory#2 (comment) * Remove semver and sha2 re-exports These re-exports appear to be unnecessary, and doesn't have any impact on code that rely on the `inventory` module (and have the `semver` and/or `sha2` features enabled). Also see related prior discussion here Malax/inventory#2 (comment). The `semver` and `sha2` modules only contain implementations of public traits, so I don't think we need to re-export those (unlike bringing for instance a function or struct in to scope). If I understand how trait implementations work correctly, it doesn't matter where an implementation lives (only the visibility of the trait and the type it's implemented for is relevant) - in other words, the implementation will be available to any code that can access both the trait and the type, even across crate binaries. * Rename `semver` feature to `inventory-semver` * Rename `sha2` feature to `inventory-sha2` * [stacked] Add docs to inventory code (#864) * Add module docs and example * Document resolve and partial_resolve * Document more inventory methods * Document Artifact * Document ArtifactRequirement I also suggest we change the name of `inventory/version` to `inventory/artifact_requirement.rs` or `requirement.rs`. * Update example to compare Checksum instead of string * Apply suggestions from code review Co-authored-by: Rune Soerensen <rsoerensen@salesforce.com> * Update feature names * Rewrite example usage * Show how to display checksum in example --------- Co-authored-by: Rune Soerensen <rsoerensen@salesforce.com> * Group inventory features alphabetically --------- Co-authored-by: Manuel Fuchs <manuel.fuchs@salesforce.com> Co-authored-by: Josh W Lewis <josh.lewis@salesforce.com> Co-authored-by: Richard Schneeman <richard.schneeman+no-recruiters@gmail.com>
No description provided.