pub struct Requirement {
pub ident: MeshIdent,
pub locality: Locality,
pub supply: Supply,
pub provides: Option<Box<WorkloadSpec>>,
}Expand description
One thing a workload needs before it can run (W338).
Widens WorkloadSpec::depends_on rather than adding a second concept
beside it: a requirement names an identity and answers the two questions the
bare ident list cannot — which providers count (Locality) and what to
do when none exists (Supply).
Each member of a group keeps its own mesh identity. A provider that may be satisfied remotely must be independently discoverable, so a requirement is an edge between two identities, never a way to collapse several workloads under one. Nothing about addressing, teardown-by-identity or the service-record rail changes.
Fields§
§ident: MeshIdentMesh identity of the provider. The same currency a
WorkloadSpec::depends_on entry is written in.
locality: LocalityWhich providers count as satisfying this. Defaults to
Locality::Anywhere, the depends_on meaning.
supply: SupplyWhat to do when nothing satisfies it. Defaults to Supply::Wait, the
depends_on meaning.
provides: Option<Box<WorkloadSpec>>The provider’s own spec, carried here when supply = "self".
Required for Supply::SelfProvision and forbidden for
Supply::Wait — a wait requirement names a provider someone else
declares, so a spec here would have no owner. Both directions are
enforced by validate::shape.
Boxed because this makes WorkloadSpec recursive. The recursion is
bounded at depth 1: a provides spec may not itself carry a
self-supplied requirement (also enforced in validate::shape), so
composition stays a requirer plus its immediate providers rather than an
arbitrarily deep tree.
Trait Implementations§
Source§impl Clone for Requirement
impl Clone for Requirement
Source§fn clone(&self) -> Requirement
fn clone(&self) -> Requirement
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Requirement
impl Debug for Requirement
Source§impl<'de> Deserialize<'de> for Requirement
impl<'de> Deserialize<'de> for Requirement
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 PartialEq for Requirement
impl PartialEq for Requirement
Source§impl Serialize for Requirement
impl Serialize for Requirement
impl StructuralPartialEq for Requirement
Source§impl TS for Requirement
impl TS for Requirement
Source§type WithoutGenerics = Requirement
type WithoutGenerics = Requirement
WithoutGenerics should just be Self.
If the type does have generic parameters, then all generic parameters must be replaced with
a dummy type, e.g ts_rs::Dummy or (). The only requirement for these dummy types is that
EXPORT_TO must be None. Read moreSource§type OptionInnerType = Requirement
type OptionInnerType = Requirement
std::option::Option<T>, then this associated type is set to T.
All other implementations of TS should set this type to Self instead.Source§fn docs() -> Option<String>
fn docs() -> Option<String>
TS is derived, docs are
automatically read from your doc comments or #[doc = ".."] attributesSource§fn decl_concrete(cfg: &Config) -> String
fn decl_concrete(cfg: &Config) -> String
TS::decl().
If this type is not generic, then this function is equivalent to TS::decl().Source§fn decl(cfg: &Config) -> String
fn decl(cfg: &Config) -> String
type User = { user_id: number, ... }.
This function will panic if the type has no declaration. Read moreSource§fn inline(cfg: &Config) -> String
fn inline(cfg: &Config) -> String
{ user_id: number }.
This function will panic if the type cannot be inlined.Source§fn inline_flattened(cfg: &Config) -> String
fn inline_flattened(cfg: &Config) -> String
Source§fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn output_path() -> Option<PathBuf>
fn output_path() -> Option<PathBuf>
T should be exported, relative to the output directory.
The returned path does not include any base directory. Read moreSource§fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
Source§fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export_all. Read moreSource§fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export. Read more