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>
impl<Str: Clone, ArrayStr: Clone> Clone for PropertyName<Str, ArrayStr>
Source§fn clone(&self) -> PropertyName<Str, ArrayStr>
fn clone(&self) -> PropertyName<Str, ArrayStr>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more