Skip to main content

PropertyName

Enum PropertyName 

Source
pub enum PropertyName<Str, ArrayStr> {
    SingleProp(Str),
    MultipleProps(ArrayStr),
}
Expand description

Either a single or several CSS property names.

This enumeration is used when defining plugins to specify which CSS property name should be generated. In the case of several property names (i.e MultipleProps), the CSS value will be copied to all the properties.

When using the build_plugin prelude, the variants of this enumeration are reexported so that you can simply write SingleProp and MultipleProps without having to prefix them with PropertyName::.

When defining a plugin using TOML, if you use a string, the SingleProp variant will automatically be used, and if you use an array, the MultipleProps variants will be used.

Variants§

§

SingleProp(Str)

A single CSS property name.

§

MultipleProps(ArrayStr)

Several CSS property names in the order they will be generated.

The CSS value defined by the plugin will be copied to each of the properties.

§Example
use encre_css::{Config, generate};
use encre_css::prelude::build_plugin::*;

const PLUGIN: StaticPlugin = Plugin::Color(Color {
    namespace: "custom-decoration",
    prop: MultipleProps(&["-webkit-text-decoration-color", "text-decoration-color"]),
    ..Color::default()
});

let mut config = Config::default();
config.register_plugin(&PLUGIN);

let generated = generate(["custom-decoration-red-200"], &config);

assert!(generated.ends_with(r".custom-decoration-red-200 {
  -webkit-text-decoration-color: oklch(88.5% .062 18.334);
  text-decoration-color: oklch(88.5% .062 18.334);
}"));

Trait Implementations§

Source§

impl<Str: Clone, ArrayStr: Clone> Clone for PropertyName<Str, ArrayStr>

Source§

fn clone(&self) -> PropertyName<Str, ArrayStr>

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<Str: Copy, ArrayStr: Copy> Copy for PropertyName<Str, ArrayStr>

Source§

impl<Str: Debug, ArrayStr: Debug> Debug for PropertyName<Str, ArrayStr>

Source§

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

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

impl<'de, Str, ArrayStr> Deserialize<'de> for PropertyName<Str, ArrayStr>
where Str: Deserialize<'de>, ArrayStr: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<Str: PartialEq, ArrayStr: PartialEq> PartialEq for PropertyName<Str, ArrayStr>

Source§

fn eq(&self, other: &PropertyName<Str, ArrayStr>) -> bool

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

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

Inequality operator !=. Read more
Source§

impl<Str, ArrayStr> Serialize for PropertyName<Str, ArrayStr>
where Str: Serialize, ArrayStr: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<Str: PartialEq, ArrayStr: PartialEq> StructuralPartialEq for PropertyName<Str, ArrayStr>

Auto Trait Implementations§

§

impl<Str, ArrayStr> Freeze for PropertyName<Str, ArrayStr>
where Str: Freeze, ArrayStr: Freeze,

§

impl<Str, ArrayStr> RefUnwindSafe for PropertyName<Str, ArrayStr>
where Str: RefUnwindSafe, ArrayStr: RefUnwindSafe,

§

impl<Str, ArrayStr> Send for PropertyName<Str, ArrayStr>
where Str: Send, ArrayStr: Send,

§

impl<Str, ArrayStr> Sync for PropertyName<Str, ArrayStr>
where Str: Sync, ArrayStr: Sync,

§

impl<Str, ArrayStr> Unpin for PropertyName<Str, ArrayStr>
where Str: Unpin, ArrayStr: Unpin,

§

impl<Str, ArrayStr> UnsafeUnpin for PropertyName<Str, ArrayStr>
where Str: UnsafeUnpin, ArrayStr: UnsafeUnpin,

§

impl<Str, ArrayStr> UnwindSafe for PropertyName<Str, ArrayStr>
where Str: UnwindSafe, ArrayStr: UnwindSafe,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> 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 = !

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.