Skip to main content

OpSpec

Struct OpSpec 

Source
pub struct OpSpec {
Show 14 fields pub id: String, pub version: u32, pub title: String, pub family: String, pub summary: String, pub inputs: Vec<PortSpec>, pub outputs: Vec<PortSpec>, pub params: Vec<ParamSpec>, pub margin: Margin, pub source: OpSource, pub finish: Option<String>, pub effects: bool, pub available: bool, pub unavailable: Option<String>,
}
Expand description

What an op is: everything a menu, an inspector, a pipeline check, an agent and the runtime need to know, without running it.

Fields§

§id: String

Its id, unique in its namespace (dspk:highpass, gaussian_blur, script:local_contrast).

§version: u32

Built-in and tool ops: a whole number from 1, bumped when the op’s behaviour changes. Scripts and recipes are versioned by their hash (OpSpec::version_key).

§title: String

Its name for people.

§family: String

Its group in the Operations menu (Filter, Detect).

§summary: String

One line: what it does.

§inputs: Vec<PortSpec>

What it reads.

§outputs: Vec<PortSpec>

What it gives.

§params: Vec<ParamSpec>

What it is tuned with.

§margin: Margin

How far it looks beyond its piece.

§source: OpSource

Where its code is.

§finish: Option<String>

How its pieces’ outputs are joined after the last piece (lucem’s stitch_labels); None: in piece order.

§effects: bool

It acts outside the store (uploads, drives an instrument, sends a message, deletes): never reused from an earlier run, never previewed, asks before each run.

§available: bool

Whether it can run here; when not, OpSpec::unavailable says why.

§unavailable: Option<String>

Why it cannot run here (“weights not downloaded”, “needs CUDA”).

Implementations§

Source§

impl OpSpec

Source

pub fn new(id: impl Into<String>, title: impl Into<String>) -> Self

A built-in operation id titled title, with nothing declared yet.

Source

pub fn family(self, family: impl Into<String>) -> Self

Sets its family.

Source

pub fn summary(self, summary: impl Into<String>) -> Self

Sets its line.

Source

pub fn input(self, port: PortSpec) -> Self

Adds an input.

Source

pub fn output(self, port: PortSpec) -> Self

Adds an output.

Source

pub fn param(self, param: ParamSpec) -> Self

Adds a parameter.

Source

pub fn margin(self, margin: Margin) -> Self

Sets its margin.

Source

pub fn context(self, margin: Margin) -> Self

Sets its margin (the name kitchen-pipeline used before the standard).

Source

pub fn version(self, version: u32) -> Self

Sets its version (built-in and tool ops).

Source

pub fn finish(self, finish: impl Into<String>) -> Self

Sets how its pieces are joined.

Source

pub fn effects(self) -> Self

Marks it as acting outside the store.

Source

pub fn unavailable(self, why: impl Into<String>) -> Self

Marks it as unable to run here, with why.

Source

pub fn version_key(&self) -> String

What versions it for run keys: the hash of a script or a recipe, else v<version>.

Source

pub fn input_port(&self, name: &str) -> Option<&PortSpec>

The input name.

Source

pub fn output_port(&self, name: &str) -> Option<&PortSpec>

The output name.

Source

pub fn check(&self) -> Result<(), String>

Well formed: an id, at least one output, unique port and parameter names, defaults that fit their parameters.

Trait Implementations§

Source§

impl Clone for OpSpec

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OpSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for OpSpec

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for OpSpec

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for OpSpec

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for OpSpec

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for OpSpec

Auto Trait Implementations§

§

impl Forget for OpSpec

§

impl Freeze for OpSpec

§

impl Move for OpSpec

§

impl RefUnwindSafe for OpSpec

§

impl Send for OpSpec
where RawVecInner: Send,

§

impl Sync for OpSpec
where RawVecInner: Sync,

§

impl Unpin for OpSpec
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for OpSpec

§

impl UnwindSafe for OpSpec
where RawVecInner: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.