#[non_exhaustive]pub struct Descriptor {Show 19 fields
pub ty: Type,
pub label: String,
pub description: String,
pub default: Value,
pub hard: Option<(f64, f64)>,
pub soft: Option<(f64, f64)>,
pub step: f64,
pub coarse: f64,
pub unit: Option<String>,
pub display_scale: f64,
pub precision: u32,
pub choices: Vec<String>,
pub count: Option<u32>,
pub capacity: Option<u32>,
pub path: Option<PathHint>,
pub writers: Writers,
pub sensitive: bool,
pub scopes: Vec<ValueScope>,
pub note: bool,
}Expand description
What a value is and how it is shown and moved.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.ty: Type§label: String§description: String§default: Value§hard: Option<(f64, f64)>What the value can be, at most.
soft: Option<(f64, f64)>What a slider spans; past it up to hard only when forced.
step: f64§coarse: f64§unit: Option<String>§display_scale: f64Shown value = value × scale.
precision: u32Decimals shown.
choices: Vec<String>§count: Option<u32>How many values a list holds at most.
capacity: Option<u32>How many bytes a text holds at most.
path: Option<PathHint>A text that names a path on disk.
writers: WritersWho may write it besides its owner.
sensitive: boolA secret (a token, a password): never written to a settings export, never read from one.
scopes: Vec<ValueScope>The host’s value scopes it may also be set for, above app
(opt-in, crate::admin::ValueScope); empty: app-wide only.
note: boolNot a value but a read-only line, its words the label
(Descriptor::note): a dialog’s form shows it under the fields
before it and answers no value for it.
Implementations§
Source§impl Descriptor
impl Descriptor
Sourcepub fn note(text: &str) -> Descriptor
pub fn note(text: &str) -> Descriptor
A read-only line of a form, what the command will also do (“Also
updates 2 templates”): the forms’ counterpart of the admin forms’
note field kind.
Sourcepub fn float(label: &str, min: f64, max: f64, default: f64) -> Descriptor
pub fn float(label: &str, min: f64, max: f64, default: f64) -> Descriptor
A float in [min, max], its fine step a hundredth of the range.
pub fn int(label: &str, min: i64, max: i64, default: i64) -> Descriptor
pub fn bool(label: &str, default: bool) -> Descriptor
pub fn choice(label: &str, choices: &[&str], default: &str) -> Descriptor
pub fn text(label: &str, default: &str) -> Descriptor
Sourcepub fn floats(
label: &str,
count: u32,
min: f64,
max: f64,
default: &[f64],
) -> Descriptor
pub fn floats( label: &str, count: u32, min: f64, max: f64, default: &[f64], ) -> Descriptor
Floats in [min, max], at most count of them.
Sourcepub fn ints(
label: &str,
count: u32,
min: i64,
max: i64,
default: &[i64],
) -> Descriptor
pub fn ints( label: &str, count: u32, min: i64, max: i64, default: &[i64], ) -> Descriptor
Ints in [min, max], at most count of them.
Sourcepub fn path(label: &str, kind: PathKind, extensions: &[&str]) -> Descriptor
pub fn path(label: &str, kind: PathKind, extensions: &[&str]) -> Descriptor
A text naming a directory or a file, empty by default; for a file, the extensions accepted (none: any).
Sourcepub fn dialog_title(self, title: &str) -> Descriptor
pub fn dialog_title(self, title: &str) -> Descriptor
A path’s chooser title, a task (“Open a workspace”) rather than the field’s label; nothing for a value that names no path.
Sourcepub fn dialog_purpose(self, key: &str) -> Descriptor
pub fn dialog_purpose(self, key: &str) -> Descriptor
The key a path’s chooser remembers its last folder under (default: the form’s command and the field’s key); nothing for a value that names no path.
Sourcepub fn filter_name(self, name: &str) -> Descriptor
pub fn filter_name(self, name: &str) -> Descriptor
What a path’s chooser calls its extensions’ filter (“Enrolment files”); nothing for a value that names no path.
pub fn description(self, text: &str) -> Descriptor
Sourcepub fn soft(self, lo: f64, hi: f64) -> Descriptor
pub fn soft(self, lo: f64, hi: f64) -> Descriptor
The range a slider spans, within the hard range.
Sourcepub fn step(self, step: f64) -> Descriptor
pub fn step(self, step: f64) -> Descriptor
The fine step (the coarse one becomes ten of them).
pub fn coarse(self, coarse: f64) -> Descriptor
pub fn unit(self, unit: &str) -> Descriptor
Sourcepub fn display(self, scale: f64, precision: u32) -> Descriptor
pub fn display(self, scale: f64, precision: u32) -> Descriptor
Shown value = value × scale, with so many decimals.
Sourcepub fn capacity(self, bytes: u32) -> Descriptor
pub fn capacity(self, bytes: u32) -> Descriptor
At most so many bytes of text.
Sourcepub fn writers(self, writers: &[OwnerId]) -> Descriptor
pub fn writers(self, writers: &[OwnerId]) -> Descriptor
Lets these write it too, besides its owner (one writer per value otherwise).
Sourcepub fn any_writer(self) -> Descriptor
pub fn any_writer(self) -> Descriptor
Lets anyone write it.
Sourcepub fn scopes(self, scopes: &[ValueScope]) -> Descriptor
pub fn scopes(self, scopes: &[ValueScope]) -> Descriptor
Opts into host value scopes: the settings app offers “Set for”
with app and these (those the host has open).
Sourcepub fn sensitive(self) -> Descriptor
pub fn sensitive(self) -> Descriptor
A secret: left out of settings exports and refused from them.
Trait Implementations§
Source§impl Clone for Descriptor
impl Clone for Descriptor
Source§fn clone(&self) -> Descriptor
fn clone(&self) -> Descriptor
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Descriptor
impl Debug for Descriptor
Source§impl PartialEq for Descriptor
impl PartialEq for Descriptor
Source§impl Serialize for Descriptor
impl Serialize for Descriptor
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Descriptor
Auto Trait Implementations§
impl Freeze for Descriptor
impl RefUnwindSafe for Descriptor
impl Send for Descriptor
impl Sync for Descriptor
impl Unpin for Descriptor
impl UnsafeUnpin for Descriptor
impl UnwindSafe for Descriptor
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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§impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.