Skip to main content

AppearanceRule

Struct AppearanceRule 

Source
#[non_exhaustive]
pub struct AppearanceRule { pub id: String, pub target: AppearanceTarget, pub names: Vec<String>, pub context: AppearanceContext, pub criteria: Option<String>, pub priority: i32, pub font: Option<Tint>, pub back: Option<Tint>, pub bold: Option<bool>, pub enabled: Option<bool>, pub visible: Option<bool>, /* private fields */ }
Expand description

Changes how things look or behave, for records that meet a condition. It is about looks: it does not protect data, which is what permissions are for.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§id: String

What it is known by.

§target: AppearanceTarget

The kind of thing it changes.

§names: Vec<String>

The names of those things, where * stands for any text. A list that starts with a lone * means all but the names after it.

§context: AppearanceContext

Where it applies.

§criteria: Option<String>

The expression a record has to meet. With none, and no function, it always applies.

§priority: i32

Whichever is higher wins, for what both change.

§font: Option<Tint>

The color of the text.

§back: Option<Tint>

The color behind it.

§bold: Option<bool>

Heavier text.

§enabled: Option<bool>

Whether it can be used.

§visible: Option<bool>

Whether it shows.

Implementations§

Source§

impl AppearanceRule

Source

pub fn new( id: impl Into<String>, names: impl IntoIterator<Item = impl Into<String>>, ) -> Self

A rule about fields with these names, as * or open*.

Source

pub fn target(self, target: AppearanceTarget) -> Self

About this kind of thing.

Source

pub fn context(self, context: AppearanceContext) -> Self

Only in these views.

Source

pub fn criteria(self, expression: impl Into<String>) -> Self

For records that meet this expression.

Source

pub fn when(self, condition: impl Fn(&Object) -> bool + 'static) -> Self

For records this says yes to.

Source

pub fn priority(self, priority: i32) -> Self

Whichever is higher wins.

Source

pub fn font(self, tint: Tint) -> Self

The color of the text.

Source

pub fn back(self, tint: Tint) -> Self

The color behind it.

Source

pub fn bold(self) -> Self

Heavier text.

Source

pub fn enabled(self, enabled: bool) -> Self

Whether it can be used.

Source

pub fn visible(self, visible: bool) -> Self

Whether it shows.

Trait Implementations§

Source§

impl Clone for AppearanceRule

Source§

fn clone(&self) -> AppearanceRule

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for AppearanceRule

Source§

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

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

impl PartialEq for AppearanceRule

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

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

Source§

type Output = T

Should always be Self
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.