Skip to main content

CaixaVersion

Struct CaixaVersion 

Source
pub struct CaixaVersion(pub String);
Expand description

A caixa’s pinned version — a thin typed wrapper over a String that parses as semver::Version on demand.

Stored as a String at rest so authoring a caixa.lisp stays a single quoted literal. The typed form is reached through Self::parse.

Tuple Fields§

§0: String

Implementations§

Source§

impl CaixaVersion

Source

pub fn parse(&self) -> Result<Version, VersionError>

Parse and validate the wrapped string as semver.

Source

pub const fn as_str(&self) -> &str

Borrow the string form.

Trait Implementations§

Source§

impl AsRef<str> for CaixaVersion

Substrate-canonical AsRef<str> projection on the CaixaVersion typed newtype — routes through the same CaixaVersion::as_str pub const fn scalar accessor the sibling fmt::Display impl and every downstream &str-shaped consumer already keys off, so any future consumer that binds a CaixaVersion through the standard-library impl AsRef<str> bound (a Path-shaped file- system reader on the operator side that accepts the version body as one segment of a per-caixa versao/<v>/... on-disk cache path, a builder-shaped API on the future feira publish writer verb that composes <prefix><versao> through a git-tag builder crate’s impl AsRef<str> join step, a HashMap<CaixaVersion, _> lookup through the map.get::<str>(v.as_ref()) shape a future version-keyed dispatch table lands on) reaches the wrapped String through one substrate-primitive dispatch rather than through the pre-lift .as_str() open-coded projection at every wire-up.

Peer of the sibling fmt::Display impl on the same primitive — both delegate to the shared CaixaVersion::as_str pub const fn accessor, so [format!("{v}")], v.as_str(), and <CaixaVersion as AsRef<str>>::as_ref(&v) resolve to the same byte-string per instance by construction. A future rebrand of the wrapped storage (a hypothetical widening to a typed semver::Version slot the roadmap acknowledges once eager parse-on-construct discipline lands, an internal normalization step that trims leading zeroes off pre-release identifiers, a per-cluster overlay the operator pins through a future :versao-overrides slot) that changes what CaixaVersion::as_str returns migrates every consumer of every one of the three paths in lockstep.

Same “route the trait impl through the substrate-primitive accessor” discipline the sibling fmt::Display impl on this type already carries — extends it onto the standard-library AsRef<str> projection axis every third-party API that takes impl AsRef<str> (the std::path::Path::new / std::fs interop surface, std::process::Command::arg, the peer tracing::field::Value recorder’s Str-arm, every clap-side value_parser! fold that accepts an owned newtype through impl AsRef<str>) already binds through. Rust-side newtype convention pairs AsRef<str> and fmt::Display on the same primitive so a caller who has one has both; before this lift, CaixaVersion carried fmt::Display but not the paired AsRef<str> impl the convention names.

The first standard-library trait added to CaixaVersion beyond the pre-existing serde::Serialize / serde::Deserialize / Debug / Clone / PartialEq / Eq / Hash derives and the paired fmt::Display / From<String> / From<&str> hand-written impls. Pinned load-bearing by [tests::caixa_version_as_ref_str_routes_through_as_str_accessor] (byte-parity pin against CaixaVersion::as_str) — any future silent detour that routes the impl through a divergent projection (a Cow<'_, str> intermediate, a stray .to_lowercase() normalization, a swap onto a per-arm inline &self.0.as_str() re-inlining) trips at caixa-core test time under assert_eq! rather than at a downstream impl AsRef<str>-bound consumer’s silent split.

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for CaixaVersion

Source§

fn clone(&self) -> CaixaVersion

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CaixaVersion

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CaixaVersion

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for CaixaVersion

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for CaixaVersion

Source§

impl From<&str> for CaixaVersion

Source§

fn from(s: &str) -> Self

Converts to this type from the input type.
Source§

impl From<String> for CaixaVersion

Source§

fn from(s: String) -> Self

Converts to this type from the input type.
Source§

impl Hash for CaixaVersion

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for CaixaVersion

Source§

fn eq(&self, other: &CaixaVersion) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for CaixaVersion

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for CaixaVersion

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.