maycoon_theme::style

Struct Style

source
pub struct Style { /* private fields */ }
Expand description

Styling map for defining widget appearance.

Implementations§

source§

impl Style

source

pub fn new() -> Self

Create a new empty style.

source

pub fn from_values(values: impl IntoIterator<Item = (String, StyleVal)>) -> Self

Create a style from an array of strings and style values.

source

pub fn remove(&mut self, name: impl ToString)

Removes the style value from the map with the give name.

source

pub fn with_value(self, name: impl ToString, value: StyleVal) -> Self

Insert a style value with the given name into the style map.

source

pub fn set(&mut self, name: impl ToString, value: StyleVal)

Set a style value by name.

source

pub fn set_color(&mut self, name: impl ToString, color: Color)

Set a color style value by name.

source

pub fn set_gradient(&mut self, name: impl ToString, gradient: Gradient)

Set a gradient style value by name.

source

pub fn set_bool(&mut self, name: impl ToString, value: bool)

Set a bool style value by name.

source

pub fn set_brush(&mut self, name: impl ToString, brush: Brush)

Set a brush style value by name.

source

pub fn set_float(&mut self, name: impl ToString, value: f32)

Set a float style value by name.

source

pub fn set_int(&mut self, name: impl ToString, value: i32)

Set an int style value by name.

source

pub fn set_uint(&mut self, name: impl ToString, value: u32)

Set an unsized int style value by name.

source

pub fn get(&self, name: impl ToString) -> Option<StyleVal>

Get a style value by name. Returns None if the value name does not exist.

source

pub fn get_color(&self, name: impl ToString) -> Option<Color>

Get a color style value by name. Returns None if the value name does not exist.

source

pub fn get_gradient(&self, name: impl ToString) -> Option<Gradient>

Get a gradient style value by name. Returns None if the value name does not exist.

source

pub fn get_brush(&self, name: impl ToString) -> Option<Brush>

Get a brush style value by name. Returns None if the value name does not exist.

source

pub fn get_float(&self, name: impl ToString) -> Option<f32>

Get a float style value by name. Returns None if the value name does not exist.

source

pub fn get_int(&self, name: impl ToString) -> Option<i32>

Get an int style value by name. Returns None if the value name does not exist.

source

pub fn get_uint(&self, name: impl ToString) -> Option<u32>

Get an unsized int style value by name. Returns None if the value name does not exist.

source

pub fn get_bool(&self, name: impl ToString) -> Option<bool>

Get a bool style value by name. Returns None if the value name does not exist.

Trait Implementations§

source§

impl Clone for Style

source§

fn clone(&self) -> Style

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Style

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Style

source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for Style

§

impl !RefUnwindSafe for Style

§

impl Send for Style

§

impl Sync for Style

§

impl Unpin for Style

§

impl !UnwindSafe for Style

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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
source§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.