pub struct StudyInput {
pub id: String,
pub label: String,
pub value: InputValue,
pub default: InputValue,
pub kind: InputKind,
}Expand description
An editable input, with a stable study-local id and its current value.
Fields§
§id: StringId passed to Indicator::set_input.
label: StringUser-facing field label.
value: InputValueCurrent value.
default: InputValueInitial value, retained when the current value is edited.
kind: InputKindAccepted values, used to build the editor.
Implementations§
Source§impl StudyInput
impl StudyInput
Sourcepub fn new(
id: impl Into<String>,
label: impl Into<String>,
value: InputValue,
kind: InputKind,
) -> Self
pub fn new( id: impl Into<String>, label: impl Into<String>, value: InputValue, kind: InputKind, ) -> Self
Define an input for a host study.
Sourcepub fn with_default(self, value: InputValue) -> Self
pub fn with_default(self, value: InputValue) -> Self
Set the declared default independently of the current value.
Sourcepub fn accepts(&self, value: &InputValue) -> bool
pub fn accepts(&self, value: &InputValue) -> bool
Check a value against this input’s schema. Setters must also validate values.
Trait Implementations§
Source§impl Clone for StudyInput
impl Clone for StudyInput
Source§fn clone(&self) -> StudyInput
fn clone(&self) -> StudyInput
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for StudyInput
impl RefUnwindSafe for StudyInput
impl Send for StudyInput
impl Sync for StudyInput
impl Unpin for StudyInput
impl UnsafeUnpin for StudyInput
impl UnwindSafe for StudyInput
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more