pub struct SchemaVersion {
pub value: String,
pub from_legacy_int: bool,
}Expand description
T-265 PR-a: compose schema version. Stored as a semver string;
validate-time check (validate::validate) enforces the semver
shape via the semver crate.
Custom Deserialize accepts two shapes:
- YAML string (e.g.
version: "2.0.0") — taken verbatim; semver shape is checked later at validate time, NOT here, so the deserializer’s job stays narrow (parse, not validate). - YAML integer literal
2only (the one legacy value that ever shipped in any in-tree compose) → coerced toSchemaVersioncarrying"2.0.0"AND flaggedfrom_legacy_int = true. The load orchestration inCompose::loadreads that flag to decide whether to auto-rewrite the on-disk file so the integer self-heals to the semver shape (owner-ratified tg 2989 + tg 3440, “option 1 + variant A”).
Anything else — version: 1, version: 3, version: true,
version: [1,2,3] — fails to deserialize with a message that
names the constraint: only "X.Y.Z" or the legacy 2.
from_legacy_int is #[serde(skip)] so it never round-trips
through serialize; it’s a deserialize-side signal only.
Fields§
§value: String§from_legacy_int: boolImplementations§
Trait Implementations§
Source§impl Clone for SchemaVersion
impl Clone for SchemaVersion
Source§fn clone(&self) -> SchemaVersion
fn clone(&self) -> SchemaVersion
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SchemaVersion
impl Debug for SchemaVersion
Source§impl<'de> Deserialize<'de> for SchemaVersion
impl<'de> Deserialize<'de> for SchemaVersion
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Eq for SchemaVersion
Source§impl PartialEq for SchemaVersion
impl PartialEq for SchemaVersion
Source§fn eq(&self, other: &SchemaVersion) -> bool
fn eq(&self, other: &SchemaVersion) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for SchemaVersion
impl Serialize for SchemaVersion
impl StructuralPartialEq for SchemaVersion
Auto Trait Implementations§
impl Freeze for SchemaVersion
impl RefUnwindSafe for SchemaVersion
impl Send for SchemaVersion
impl Sync for SchemaVersion
impl Unpin for SchemaVersion
impl UnsafeUnpin for SchemaVersion
impl UnwindSafe for SchemaVersion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.