pub enum Availability {
Always,
Runtime,
BuildTime,
Authenticated,
}Expand description
Where a capability means anything: the environment a caller must be in for it to answer at all.
The published site and the running server are genuinely different places. Without this on the model, every template grows its own idea of what works where — and the usual shape that takes is a condition on the page’s own address, which is a rule hidden where nobody will find it and nothing can test it. This is the only thing a projection may ask.
It is classified rather than declared: the facts that decide it — what kind of thing
this is and which transports it is projected through — are already on the descriptor,
and asking each declaration to restate them would be the same knowledge written twice.
Availability::classify is the one place the rule lives.
Variants§
Always
True in every environment, a published page with no server included: the layer’s own content, which a build renders and a process serves from the same index.
Runtime
A process must be running to answer: everything with a handler, whether it is reached over HTTP, over MCP or from the command line.
BuildTime
A value captured when the site was generated, rendered afterwards as the capture it is. Nothing classifies to this yet; the static projection of the graph is what will declare it, and it is on the model so that a captured value can be labelled as captured instead of being shown as current.
Authenticated
A process must be running and the caller must be one it has authenticated. Nothing in this repository authenticates a caller yet; a surface that does will say so here rather than in the template that renders its link.
Implementations§
Source§impl Availability
impl Availability
Sourcepub fn classify(kind: CapabilityKind, _exposure: &Exposure) -> Availability
pub fn classify(kind: CapabilityKind, _exposure: &Exposure) -> Availability
Classify from what the descriptor already declares.
The match is exhaustive on purpose and has no fallback arm: a new kind, or a
transport that changes what an environment can offer, is a compile error here
rather than a silent Always in a page that then links to nothing.
use majordomus_cli::capability::{Availability, CapabilityKind, Exposure};
let nowhere = Exposure::default();
assert_eq!(Availability::classify(CapabilityKind::Resource, &nowhere), Availability::Always);
assert_eq!(Availability::classify(CapabilityKind::Query, &nowhere), Availability::Runtime);Trait Implementations§
Source§impl Clone for Availability
impl Clone for Availability
Source§fn clone(&self) -> Availability
fn clone(&self) -> Availability
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for Availability
Source§impl Debug for Availability
impl Debug for Availability
Source§impl<'de> Deserialize<'de> for Availability
impl<'de> Deserialize<'de> for Availability
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>,
impl Eq for Availability
Source§impl JsonSchema for Availability
impl JsonSchema for Availability
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Ord for Availability
impl Ord for Availability
Source§fn cmp(&self, other: &Availability) -> Ordering
fn cmp(&self, other: &Availability) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for Availability
impl PartialEq for Availability
Source§fn eq(&self, other: &Availability) -> bool
fn eq(&self, other: &Availability) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for Availability
impl PartialOrd for Availability
Source§impl Serialize for Availability
impl Serialize for Availability
impl StructuralPartialEq for Availability
Auto Trait Implementations§
impl Freeze for Availability
impl RefUnwindSafe for Availability
impl Send for Availability
impl Sync for Availability
impl Unpin for Availability
impl UnsafeUnpin for Availability
impl UnwindSafe for Availability
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.