Skip to main content

ParamSpec

Struct ParamSpec 

Source
pub struct ParamSpec {
    pub name: String,
    pub kind: ParamKind,
    pub default: ParamValue,
    pub hint: String,
}
Expand description

A parameter of an op: the Inspector draws a control for it.

Fields§

§name: String

Its name, as the function takes it (sigma).

§kind: ParamKind

What it takes.

§default: ParamValue

Its value when a pipeline gives none.

§hint: String

One line for people (the Inspector’s tooltip).

Implementations§

Source§

impl ParamSpec

Source

pub fn number(name: impl Into<String>, default: f64) -> Self

A number name, default when not given.

Source

pub fn integer(name: impl Into<String>, default: i64) -> Self

A whole number name.

Source

pub fn switch(name: impl Into<String>, default: bool) -> Self

A switch name.

Source

pub fn text(name: impl Into<String>, default: impl Into<String>) -> Self

Text name.

Source

pub fn choice(name: impl Into<String>, options: &[&str]) -> Self

One of options, the first by default.

Source

pub fn range(self, lo: f64, hi: f64) -> Self

The same parameter with a range (numbers and whole numbers).

Source

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

The same number with a unit.

Source

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

The same parameter with a line for people.

Source

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

value checked against this parameter, as the value to use (a whole number given for a number becomes a number), or why it does not fit.

Trait Implementations§

Source§

impl Clone for ParamSpec

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 ParamSpec

Source§

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

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

impl<'de> Deserialize<'de> for ParamSpec

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 ParamSpec

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 ParamSpec

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 ParamSpec

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 ParamSpec

Auto Trait Implementations§

§

impl Forget for ParamSpec

§

impl Freeze for ParamSpec

§

impl Move for ParamSpec

§

impl RefUnwindSafe for ParamSpec

§

impl Send for ParamSpec
where RawVecInner: Send,

§

impl Sync for ParamSpec
where RawVecInner: Sync,

§

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

§

impl UnsafeUnpin for ParamSpec

§

impl UnwindSafe for ParamSpec
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.