printobserver-core 0.15.5

Supervision logic for printobserver.
Documentation
//! What a sliced job says about itself, and the bounds it narrows to.

use std::collections::BTreeMap;

use printobserver_printer_api::Adjustable;
use printobserver_types::Range;
use printobserver_types::schemars::JsonSchema;
use printobserver_types::serde::{Deserialize, Serialize};

/// What a sliced job declares about itself and about what may be adjusted.
///
/// An adjustable the manifest does not name takes the envelope's own range; a
/// manifest range wider than the envelope's is narrowed to the envelope's and
/// the narrowing is recorded on the print. A manifest may only narrow.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
#[schemars(crate = "printobserver_types::schemars")]
pub struct JobManifest {
    /// The file this manifest is about, as the slicer named it.
    pub file_name: String,
    /// The material the job is sliced for.
    pub material: String,
    /// The nozzle the job is sliced for, in millimetres.
    pub nozzle_diameter_mm: f64,
    /// The slicer profile the job was sliced with.
    pub slicer_profile: String,
    /// The build sheet the job goes down on, as one of the sheet ids the
    /// server's sheet table names, such as `smooth-pei` or `textured-pei`.
    ///
    /// Every start must declare one: a start whose manifest names none is
    /// refused, and no override lets it through. Optional here only so that a
    /// manifest stored before the field existed still loads.
    // llmlint: ignore[invalid_states_unrepresentable] suppressions.toml has the reason.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[schemars(extend("x-unchecked-text" = true))]
    pub sheet: Option<String>,
    /// The range each named adjustable may take, inclusive.
    pub allowed: BTreeMap<Adjustable, Range>,
    /// Whatever else the slicer recorded.
    pub metadata: BTreeMap<String, String>,
}