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: StringIts name, as the function takes it (sigma).
kind: ParamKindWhat it takes.
default: ParamValueIts value when a pipeline gives none.
hint: StringOne line for people (the Inspector’s tooltip).
Implementations§
Source§impl ParamSpec
impl ParamSpec
Sourcepub fn number(name: impl Into<String>, default: f64) -> Self
pub fn number(name: impl Into<String>, default: f64) -> Self
A number name, default when not given.
Sourcepub fn choice(name: impl Into<String>, options: &[&str]) -> Self
pub fn choice(name: impl Into<String>, options: &[&str]) -> Self
One of options, the first by default.
Sourcepub fn range(self, lo: f64, hi: f64) -> Self
pub fn range(self, lo: f64, hi: f64) -> Self
The same parameter with a range (numbers and whole numbers).
Sourcepub fn check(&self, value: &ParamValue) -> Result<ParamValue, String>
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<'de> Deserialize<'de> for ParamSpec
impl<'de> Deserialize<'de> for ParamSpec
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for ParamSpec
impl JsonSchema for ParamSpec
Source§fn schema_id() -> Cow<'static, str>
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
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
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 moreimpl 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 ParamSpecwhere
RawVecInner: Send,
impl Sync for ParamSpecwhere
RawVecInner: Sync,
impl Unpin for ParamSpec
impl UnsafeUnpin for ParamSpecwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
impl UnwindSafe for ParamSpecwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more