Skip to main content

Switch

Struct Switch 

Source
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: usize

Implementations§

Source§

impl Switch

Source

pub fn position(self, x: usize, y: usize) -> Self

Source

pub fn size(self, width: usize, height: usize) -> Self

Source

pub fn default_on(self, on: bool) -> Self

Source

pub fn anim_speed(self, speed: f32) -> Self

Source

pub fn track_color_off(self, color: Color) -> Self

Source

pub fn track_color_on(self, color: Color) -> Self

Source

pub fn thumb_color(self, color: Color) -> Self

Source

pub fn thumb_padding(self, padding: f32) -> Self

Source

pub fn label(self, text: &str, font: Font, size: f32) -> Self

Source

pub fn label_color(self, color: Color) -> Self

Source

pub fn label_gap(self, gap: usize) -> Self

Source

pub fn is_on(&self) -> bool

Source

pub fn set_on(&mut self, on: bool)

Source

pub fn just_toggled(&self) -> bool

Source

pub fn draw(&mut self, window: &mut Window)

Trait Implementations§

Source§

impl Default for Switch

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.