pub enum ContainerManifest {
Reference(WorkloadSpec),
Recipe(ContainerBuild),
}Expand description
On-disk payload of kind = "container" — two forms, one wire type
(W324 §5).
A WorkloadSpec asserts a content-addressed identity: its
ImageRef::digest is a required sha256:<hex> and the string form
rejects a bare tag at serde-deserialize (R438-T3). A local component built
from a Dockerfile next to its workload.toml cannot satisfy that — its
image is yah-local/<name>:dev, and the digest does not exist until the
build has run. So a build recipe is not a degenerate spec with a missing
field; it is a promise to produce one, and the two are different types.
The discriminator is the presence of a [build] table. WorkloadSpec has
no build field and ContainerBuild requires one, so the two shapes are
mutually exclusive — and picking the branch explicitly (rather than with
#[serde(untagged)]) is what lets a malformed reference still report
missing field \image`` instead of “data did not match any variant”.
Only Reference crosses the postcard kamaji wire; see
[WorkloadExternal]’s doc comment for why that keeps those bytes
byte-identical to the pre-split encoding.
Variants§
Reference(WorkloadSpec)
Digest-pinned image. Crosses the wire as-is.
Recipe(ContainerBuild)
Dockerfile recipe. Local only — see ContainerBuild.
Implementations§
Source§impl ContainerManifest
impl ContainerManifest
Sourcepub fn as_spec(&self) -> Option<&WorkloadSpec>
pub fn as_spec(&self) -> Option<&WorkloadSpec>
The digest-pinned spec, or None for the recipe form.
Sourcepub fn as_recipe(&self) -> Option<&ContainerBuild>
pub fn as_recipe(&self) -> Option<&ContainerBuild>
The build recipe, or None for the reference form.
Sourcepub fn into_spec(self) -> Result<WorkloadSpec, ContainerBuild>
pub fn into_spec(self) -> Result<WorkloadSpec, ContainerBuild>
Consume the manifest, yielding the digest-pinned spec. Err carries
the recipe back so a caller that can build it still has it.
Trait Implementations§
Source§impl Clone for ContainerManifest
impl Clone for ContainerManifest
Source§fn clone(&self) -> ContainerManifest
fn clone(&self) -> ContainerManifest
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 ContainerManifest
impl Debug for ContainerManifest
Source§impl<'de> Deserialize<'de> for ContainerManifest
impl<'de> Deserialize<'de> for ContainerManifest
Source§fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl PartialEq for ContainerManifest
impl PartialEq for ContainerManifest
Source§impl Serialize for ContainerManifest
impl Serialize for ContainerManifest
impl StructuralPartialEq for ContainerManifest
Source§impl TS for ContainerManifest
impl TS for ContainerManifest
Source§type WithoutGenerics = ContainerManifest
type WithoutGenerics = ContainerManifest
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 = ContainerManifest
type OptionInnerType = ContainerManifest
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