pub enum CaixaKind {
Biblioteca,
Binario,
Servico,
Supervisor,
Aplicacao,
Acao,
}Expand description
What a caixa produces.
In caixa.lisp:
:kind Biblioteca ; library (lib/<nome>.lisp entry)
:kind Binario ; executable(s) under exe/
:kind Servico ; long-running service under servicos/
:kind Supervisor ; OTP-style typed supervisor tree (see supervisor.rs)Authored as bare symbols (Biblioteca not :biblioteca) to match the
tatara-lisp enum convention where symbols become enum discriminants via
the serde Deserialize fallthrough.
Variants§
Biblioteca
Library — exports Lisp forms for other caixas to (importar …).
Binario
Binary — one or more executables under exe/.
Servico
Service — long-running daemon under servicos/.
Supervisor
OTP-shaped supervisor — does not run any code itself; its
children are other caixas, restarted under a typed strategy.
See supervisor.rs for the full shape (SupervisorSpec).
Aplicacao
Typed application — composes multiple Servicos into a single
declarative mesh with WIT-typed :contratos, mesh-level
:politicas, and explicit :placement. See aplicacao.rs
(AplicacaoSpec) and theory/MESH-COMPOSITION.md for the
design frame.
Acao
Typed CI run — carries a :ci slot of
canteiro_types::CiRun (a repo’s CI run as a set of typed
nodes + their dependency edges). Runs no code of its own and
owns no lib/exe/servicos/children/membros code
surface — its sole payload is the ci field on crate::Caixa.
See CANTEIRO §7.1-C (pleme-io/sui’s canteiro-types crate)
for the DAG algebra (decompose/affected_set/affected_waves)
this slot feeds, and the caixa-actions renderer (currently
validate-only — see its crate docs) for the M0 consumer.
Implementations§
Source§impl CaixaKind
impl CaixaKind
pub const fn is_biblioteca(&self) -> bool
pub const fn is_binario(&self) -> bool
pub const fn is_servico(&self) -> bool
pub const fn is_supervisor(&self) -> bool
pub const fn is_aplicacao(&self) -> bool
pub const fn is_acao(&self) -> bool
Source§impl CaixaKind
impl CaixaKind
Sourcepub const ALL: &'static [Self]
pub const ALL: &'static [Self]
Exhaustive iteration surface for every consumer that walks the
closed six-arm CaixaKind discriminator set (the future M4
mesh.pleme.io/v1alpha1/Caixa CR materializer’s admission-webhook
rejection body naming the accepted-:kind list, a future
feira --kind … CLI arg-parse’s “did you mean” hint via a
Self::from_wire-scan over the slice, the future
feira app graph per-Aplicacao :kind-histogram column, any
future round-trip fuzz harness that sweeps every arm). A future
variant addition (an Actor virtual-actor arm the
ABSORPTION-ROADMAP
M5 Orleans-inspired kind reaches through — a candidate future
arm named in the sibling Self::from_wire doc block —
extends this slice as a single edit and every consumer picks up
the new entry by construction; the compiler-checked
exhaustiveness on the sibling method match arms
(Self::as_str / Self::wire_name / Self::from_wire /
the requires_* predicates) is the build-time guarantee that
no arm forgets to grow.
Peer of the sibling closed-set typed enums’
crate::aplicacao::PlacementStrategy::ALL (18c7342) /
crate::aplicacao::RateLimitUnit::ALL (6bce03d) /
crate::dep::DepList::ALL (45ee563) exhaustive-iteration
surfaces — the fourth (and structurally most fundamental —
every caixa carries a :kind) closed-set typed enum on the
caixa surface to converge onto the same
one-canonical-arm-list-per-enum discipline.
Sourcepub const fn requires_lib(self) -> bool
pub const fn requires_lib(self) -> bool
A Biblioteca is expected to have at least one lib/ entry.
Sourcepub const fn requires_exe(self) -> bool
pub const fn requires_exe(self) -> bool
A Binario is expected to have at least one exe/ entry.
Sourcepub const fn requires_servicos(self) -> bool
pub const fn requires_servicos(self) -> bool
A Servico is expected to have at least one servicos/ entry.
Sourcepub const fn requires_children(self) -> bool
pub const fn requires_children(self) -> bool
A Supervisor is expected to have at least one :children entry
(or a SimpleOneForOne strategy that spawns children dynamically).
Sourcepub const fn requires_membros(self) -> bool
pub const fn requires_membros(self) -> bool
An Aplicacao is expected to have at least one :membros entry.
Sourcepub const fn requires_ci(self) -> bool
pub const fn requires_ci(self) -> bool
An Acao is expected to carry a :ci slot (a typed
canteiro_types::CiRun). Mirror of the sibling
Self::requires_lib/Self::requires_exe/
Self::requires_servicos/Self::requires_membros required-
slot predicates on the fifth CaixaKind arm.
Sourcepub const fn wire_name(self) -> &'static str
pub const fn wire_name(self) -> &'static str
Substrate-canonical per-CaixaKind PascalCase wire byte-string
every consumer that emits the Caixa’s :kind axis onto a wire
surface outside the caixa-core boundary keys off — returns the
per-arm byte-string the paired
crate::render::CAIXA_KIND_WIRE_BIBLIOTECA /
crate::render::CAIXA_KIND_WIRE_BINARIO /
crate::render::CAIXA_KIND_WIRE_SERVICO /
crate::render::CAIXA_KIND_WIRE_SUPERVISOR /
crate::render::CAIXA_KIND_WIRE_APLICACAO /
crate::render::CAIXA_KIND_WIRE_ACAO lifted consts pin, and
Self::from_wire parses back into the typed CaixaKind
discriminator.
Byte-identical to the un-renamed Serialize derive’s per-arm
wire scalar (serde_json::to_string(&kind).unwrap() unquoted),
with the pin test
[tests::caixa_kind_wire_name_matches_serialize_wire_byte_string]
making the two paths’ byte-agreement load-bearing so a future
#[serde(rename_all = "…")] attribute drift at the derive
surface trips at caixa-core build time rather than silently
splitting the wire byte-shape from every consumer that reaches
for this typed dispatch. The paired Self::from_wire returns
Some on every string Self::wire_name emits and None on
every other input — the round-trip pin
[tests::caixa_kind_wire_round_trips_through_from_wire] locks
the two paths’ accept-sets together by construction.
Distinct axis from the sibling Self::as_str — which returns
the lowercase Portuguese diagnostic byte-string ("biblioteca"
/ "binario" / …) every consumer that formats the caixa’s
typed shape as user-facing text lands on — by design, not by
drift: the two-axis split the load-bearing pin
[tests::caixa_kind_display_matches_as_str_and_not_serialize_wire]
already encodes. This wire accessor closes the third axis on
the CaixaKind closed-set discriminator (wire byte-string),
peer of Self::as_str (human-readable byte-string) and the
std::fmt::Display impl (routed through Self::as_str).
Prior to this lift, the six [caixa-crd::conversion] +
[caixa-feira] + future-M4-CR-materializer consumers that
needed the PascalCase wire byte-shape reached for one of two
fragile paths: format!("{:?}", kind) (couples the wire format
to Debug’s stability guarantee, which Rust’s own conventions
give as no guarantee at all — a #[derive(Debug)] swap for
a hand-rolled impl Debug that pretty-prints the variant with
extra context is a permitted mechanical edit whose apply-time
symptom would be every downstream K8s CR carrying a stale wire
byte-string), or serde_json::to_string(&kind) + string-trim of
the outer quotes (introduces an allocation + error-handling
path for a byte-shape the compiler knows verbatim at build
time). Lifting the resolver to a typed method on the substrate
primitive means every downstream consumer of the Caixa’s
:kind wire surface reaches for exactly one typed dispatch —
the resolver’s accept-set migrates as a unit on any future arm
addition (a future virtual-actor Actor arm the
theory/ABSORPTION-ROADMAP.md M5 Orleans-inspired kind reaches
through, a per-cluster kind-alias table the M4 CR materializer
resolves per-CR).
Sourcepub fn from_wire(s: &str) -> Option<Self>
pub fn from_wire(s: &str) -> Option<Self>
Substrate-canonical inverse of Self::wire_name — parses a
PascalCase wire byte-string into the typed CaixaKind
discriminator, returning None on any string not in the six-arm
accept-set the sibling Self::wire_name emits.
The pair (wire_name, from_wire) forms a total round-trip
discipline on the six CaixaKind arms — every
Self::wire_name output parses back through this accessor
(pinned load-bearing by the sibling
[tests::caixa_kind_wire_round_trips_through_from_wire] test),
so consumers that emit a wire byte-string through
Self::wire_name and later re-parse it here (the K8s
[caixa_crd] CaixaSpec.kind String-carry round-trip through
caixa_into_cr + caixa_from_cr, the future M4
mesh.pleme.io/v1alpha1/Caixa CR materializer’s admission-time
wire re-parse, the future feira CLI verb that accepts a
--kind <Biblioteca|Servico|…> arg and binds it into the typed
enum) reach for one typed dispatch on the substrate primitive
instead of the hand-rolled per-arm match cascade every
pre-lift consumer previously carried verbatim. A future arm
addition (a virtual-actor Actor arm the M5 Orleans-inspired
kind reaches through) lands one caixa-core edit — the parser’s
arm-set migrates as a unit — rather than a coordinated rewrite
across every hand-rolled match cr.spec.kind.as_str() at every
downstream consumer site.
Prior to this lift, the sole in-tree consumer of the reverse
parse — [caixa_crd::conversion::caixa_from_cr] — carried a
six-arm match cr.spec.kind.as_str() { "Biblioteca" => …, "Binario" => …, "Servico" => …, "Supervisor" => …, "Aplicacao" => …, "Acao" => …, _ => CaixaKind::Biblioteca } cascade that
hard-coded every wire byte-string as a per-arm string literal
with no compile-time link back to the typed
crate::CaixaKind enum. A future variant rename or a serde
attribute drift on the derive would silently split the wire
format the forward caixa_into_cr emits from the reverse
parser’s arm-set — the CR would round-trip through JSON cleanly
but land on the _ => CaixaKind::Biblioteca silent fallback
on every non-Biblioteca variant, far from the derive-attribute
commit that caused the drift. Lifting the resolver to a typed
method on the substrate primitive closes the drift footgun by
construction: the parser’s accept-set is the same set the
Self::wire_name emitter walks, so both halves of the
round-trip migrate through one caixa-core edit on any future
arm addition.
Returns Option<CaixaKind> rather than Result<CaixaKind, _>
because the existing in-tree consumer [caixa_from_cr] carries
a hard-coded silent fallback (_ => CaixaKind::Biblioteca) —
the fallback’s shape is preserved verbatim by the caller’s
.unwrap_or(CaixaKind::Biblioteca) on the return value, so
this lift is a byte-equal behavioral swap on today’s call site
(the CR round-trip is invariant), and future callers that want
a typed error (a future feira --kind … arg-parse that
surfaces unknown kind: <arg> at the CLI) can build one on top
without disturbing the existing consumer’s contract.
Sourcepub const fn as_str(self) -> &'static str
pub const fn as_str(self) -> &'static str
The canonical human-readable name.
The five arms route through the paired
crate::render::CAIXA_KIND_LABEL_BIBLIOTECA /
crate::render::CAIXA_KIND_LABEL_BINARIO /
crate::render::CAIXA_KIND_LABEL_SERVICO /
crate::render::CAIXA_KIND_LABEL_SUPERVISOR /
crate::render::CAIXA_KIND_LABEL_APLICACAO lifted constants so
every substrate consumer that formats a caixa’s typed shape as
user-facing text (the future wasm-operator’s per-caixa startup
log line, the future feira app graph per-member kind column,
the future M4 CR materializer’s admission-webhook rejection
body) reads the same byte-string the std::fmt::Display impl
(routed through this helper) emits — the pin test
[tests::caixa_kind_as_str_returns_lifted_peer_const] asserts
the five paths agree. Peer of the sibling
crate::supervisor::RestartStrategy::as_str (09ffb2d),
crate::supervisor::RestartPolicy::as_str (ccdf955), and M3
crate::aplicacao::PlacementStrategy::as_str (cc8f749) on the
sibling closed-set typed-enum discriminator axes — the fourth
closed-set typed enum on the caixa surface to converge onto the
same drift-detection posture.
The two axes (Self::as_str returning lowercase Portuguese
vs. the un-renamed Serialize derive emitting PascalCase
"Biblioteca" / "Binario" / "Servico" / "Supervisor" /
"Aplicacao") are intentionally distinct: the wire format is
the tatara-lisp author surface (:kind Biblioteca), while
Self::as_str / std::fmt::Display emit the substrate’s
canonical human-readable form for diagnostics + graph output +
audit views. Two paths on this enum surface (rather than three
as on the sibling OTP-shape and M3 enums where wire ==
human-readable), but the same “one canonical byte-string per
axis, routed through a lifted const” discipline.
Trait Implementations§
impl Copy for CaixaKind
Source§impl<'de> Deserialize<'de> for CaixaKind
impl<'de> Deserialize<'de> for CaixaKind
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for CaixaKind
std::fmt::Display routed through CaixaKind::as_str, so the
pretty-printed byte-string every consumer that formats the caixa’s
typed shape as user-facing text lands on (the future wasm-operator’s
per-caixa startup log line, the future feira app graph per-member
kind column, the future M4 wasm.pleme.io/v1alpha1/ComputeUnit /
mesh.pleme.io/v1alpha1/* CR materializer’s admission-webhook
rejection body) reaches for the same lifted
crate::render::CAIXA_KIND_LABEL_BIBLIOTECA /
crate::render::CAIXA_KIND_LABEL_BINARIO /
crate::render::CAIXA_KIND_LABEL_SERVICO /
crate::render::CAIXA_KIND_LABEL_SUPERVISOR /
crate::render::CAIXA_KIND_LABEL_APLICACAO const the
CaixaKind::as_str helper already returns.
impl Display for CaixaKind
std::fmt::Display routed through CaixaKind::as_str, so the
pretty-printed byte-string every consumer that formats the caixa’s
typed shape as user-facing text lands on (the future wasm-operator’s
per-caixa startup log line, the future feira app graph per-member
kind column, the future M4 wasm.pleme.io/v1alpha1/ComputeUnit /
mesh.pleme.io/v1alpha1/* CR materializer’s admission-webhook
rejection body) reaches for the same lifted
crate::render::CAIXA_KIND_LABEL_BIBLIOTECA /
crate::render::CAIXA_KIND_LABEL_BINARIO /
crate::render::CAIXA_KIND_LABEL_SERVICO /
crate::render::CAIXA_KIND_LABEL_SUPERVISOR /
crate::render::CAIXA_KIND_LABEL_APLICACAO const the
CaixaKind::as_str helper already returns.
Pre-convergence CaixaKind carried no std::fmt::Display
surface at all — every consumer past the wire format
(Serialize → PascalCase) had to pick between two paths
(CaixaKind::as_str returning the lowercase Portuguese label, or
format!("{v:?}") on the Debug derive returning the PascalCase
variant name), each with different bytes on every arm and no
compile-time link between the two — with the failure surfacing as a
downstream consumer’s log / graph / diagnostic reading one spelling
while a peer consumer emitted another, far from any single-site
commit. Wiring std::fmt::Display through CaixaKind::as_str
closes the drift footgun structurally: every format!("{v}") call
reaches the same lifted [crate::render::CAIXA_KIND_LABEL_*] const
CaixaKind::as_str returns, and a future rebrand (a per-consumer
disambiguation of the :kind vocabulary, an English-canonical
rebrand of "biblioteca" → "library" under an M4 substrate-wide-
vocabulary shift) reaches every consumer through exactly one
const-edit.
The wire format axis (Serialize derive, PascalCase, tatara-lisp
author surface :kind Biblioteca) stays deliberately distinct from
the human-readable axis (Display / as_str, lowercase Portuguese
diagnostic form): the two-path split is by design, not drift. The
pin test
[tests::caixa_kind_display_matches_as_str_and_not_serialize_wire]
makes the split load-bearing so a future accidental collapse of
either axis onto the other (routing Display through the wire
format via serde_json::to_string, or routing Serialize through
CaixaKind::as_str via #[serde(rename_all = "…")]) trips at
build time rather than silently merging the two axes into one at
some future consumer.
Pin tests
[tests::caixa_kind_display_routes_through_as_str_helper] and
[tests::caixa_kind_as_str_returns_lifted_peer_const] assert the
two paths agree byte-for-byte on every variant, so a future variant
rename or per-arm serde attribute drift is a build error visible at
caixa-core test time.
Mirrors the M3 crate::aplicacao::PlacementStrategy Display
impl (aplicacao.rs:2306), the M2
crate::supervisor::RestartStrategy Display impl
(supervisor.rs:164), and the M2 crate::supervisor::RestartPolicy
Display impl (supervisor.rs:306) on the sibling closed-set typed-
enum discriminator axes — same as_str-through-Display convergence
discipline, extended to close the fourth (and structurally most
fundamental — every caixa carries a :kind) closed-set typed-enum
discriminator axis on the caixa typed surface.
impl Eq for CaixaKind
impl StructuralPartialEq for CaixaKind
Auto Trait Implementations§
impl Freeze for CaixaKind
impl RefUnwindSafe for CaixaKind
impl Send for CaixaKind
impl Sync for CaixaKind
impl Unpin for CaixaKind
impl UnsafeUnpin for CaixaKind
impl UnwindSafe for CaixaKind
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
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.