pub struct KnobSpec { /* private fields */ }Expand description
Ordered list of knob declarations. Order is preserved by the inspector when rendering the form.
Implementations§
Source§impl KnobSpec
impl KnobSpec
pub fn new() -> Self
pub fn empty() -> Self
pub fn declarations(&self) -> &[KnobDecl]
pub fn bool_(self, id: &'static str, label: &'static str, default: bool) -> Self
pub fn opt_bool( self, id: &'static str, label: &'static str, default: Option<bool>, ) -> Self
pub fn i32_( self, id: &'static str, label: &'static str, default: i32, min: i32, max: i32, ) -> Self
pub fn f32_( self, id: &'static str, label: &'static str, default: f32, min: f32, max: f32, ) -> Self
pub fn f32_step( self, id: &'static str, label: &'static str, default: f32, min: f32, max: f32, step: f32, ) -> Self
pub fn opt_i32( self, id: &'static str, label: &'static str, default: Option<i32>, min: i32, max: i32, ) -> Self
pub fn opt_f32( self, id: &'static str, label: &'static str, default: Option<f32>, min: f32, max: f32, ) -> Self
pub fn text(self, id: &'static str, label: &'static str, default: &str) -> Self
pub fn opt_text( self, id: &'static str, label: &'static str, default: Option<&str>, ) -> Self
pub fn choice( self, id: &'static str, label: &'static str, options: &[&'static str], default: usize, ) -> Self
Sourcepub fn enum_(
self,
id: &'static str,
label: &'static str,
enum_path: &'static str,
variants: &[&'static str],
default: usize,
) -> Self
pub fn enum_( self, id: &'static str, label: &'static str, enum_path: &'static str, variants: &[&'static str], default: usize, ) -> Self
A Rust enum property (e.g. ButtonVariant): variants are the Rust
idents in declaration order, default their index. Unlike choice, a
design tool can emit enum_path::variant and offer a typed dropdown.
Sourcepub fn ctor(self, pos: usize) -> Self
pub fn ctor(self, pos: usize) -> Self
Mark the most-recently-added knob as constructor argument pos
(Slider::new(value, min, max) → .f32_("min", …).ctor(1)), so a design
tool emits it positionally rather than as a named property.
pub fn text_role( self, id: &'static str, label: &'static str, default: TextRole, ) -> Self
pub fn surface_role( self, id: &'static str, label: &'static str, default: SurfaceRole, ) -> Self
pub fn border_role( self, id: &'static str, label: &'static str, default: BorderRole, ) -> Self
pub fn text_style( self, id: &'static str, label: &'static str, default: TextStyleRole, ) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KnobSpec
impl RefUnwindSafe for KnobSpec
impl Send for KnobSpec
impl Sync for KnobSpec
impl Unpin for KnobSpec
impl UnsafeUnpin for KnobSpec
impl UnwindSafe for KnobSpec
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