pub fn lockstep_range(version: &str) -> StringExpand description
The autumn-web range a crate released in lockstep with the framework
declares support for.
First-party plugins ship at the framework’s own version, so their supported
range is their own version’s compatibility key: the MAJOR.MINOR series
below 1.0 (where STABILITY.md treats every minor bump as breaking), and
the major from 1.0 on.
Pass env!("CARGO_PKG_VERSION") rather than a literal so a version bump
cannot leave a stale range behind:
use autumn_web::plugin_contract::{PluginContract, lockstep_range};
let contract = PluginContract::new(env!("CARGO_PKG_NAME"))
.autumn_web(lockstep_range(env!("CARGO_PKG_VERSION")));§This is for lockstep crates only
A crate that versions independently of autumn-web must not use this:
a third-party plugin at its own 1.2.0 would derive "1", which excludes
every 0.x framework and makes every consuming app fail at registration.
Write the range you actually support as a literal instead.
A version this cannot split into MAJOR.MINOR is returned trimmed but
otherwise unchanged, so the malformed value reaches evaluate as written
rather than being silently reshaped into a range that means something else.
Note that some such strings — "1", or the empty string — are valid
Cargo requirements (^1 and *), so a caller passing something other than
env!("CARGO_PKG_VERSION") should validate it.