pub struct Switch {Show 14 fields
pub pos_x: usize,
pub pos_y: usize,
pub width: usize,
pub height: usize,
pub on: bool,
pub anim_speed: f32,
pub track_color_off: Color,
pub track_color_on: Color,
pub thumb_color: Color,
pub thumb_padding: f32,
pub label: Option<Text>,
pub label_size: f32,
pub label_color: Color,
pub label_gap: usize,
/* private fields */
}Fields§
§pos_x: usize§pos_y: usize§width: usize§height: usize§on: bool§anim_speed: f32§track_color_off: Color§track_color_on: Color§thumb_color: Color§thumb_padding: f32§label: Option<Text>§label_size: f32§label_color: Color§label_gap: usizeImplementations§
Source§impl Switch
impl Switch
pub fn position(self, x: usize, y: usize) -> Self
pub fn size(self, width: usize, height: usize) -> Self
pub fn default_on(self, on: bool) -> Self
pub fn anim_speed(self, speed: f32) -> Self
pub fn track_color_off(self, color: Color) -> Self
pub fn track_color_on(self, color: Color) -> Self
pub fn thumb_color(self, color: Color) -> Self
pub fn thumb_padding(self, padding: f32) -> Self
pub fn label(self, text: &str, font: Font, size: f32) -> Self
pub fn label_color(self, color: Color) -> Self
pub fn label_gap(self, gap: usize) -> Self
pub fn is_on(&self) -> bool
pub fn set_on(&mut self, on: bool)
pub fn just_toggled(&self) -> bool
pub fn draw(&mut self, window: &mut Window)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Switch
impl RefUnwindSafe for Switch
impl Send for Switch
impl Sync for Switch
impl Unpin for Switch
impl UnsafeUnpin for Switch
impl UnwindSafe for Switch
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