pub struct CellStyle {
pub name: Name,
pub docs: String,
pub form: StyleForm,
pub requires: Vec<StyleRequirement>,
}Expand description
A cell style: the name an author writes in a cell’s angle brackets, what it states about the cell, and the definitions a backend needs where a cell carries it.
A feature contributes one to the service slot STYLES_SLOT with
b.peer_slot::<CellStyle>(STYLES_SLOT, Arc::new(style)): a peer
contribution, a contribution to a service slot another feature owns,
which the registry build drops with one Note when that feature is not
registered, so that the contributing feature still builds in a registry
without the cells feature. Two cell styles of one name are a registry
build error, whoever contributes them, so a cell style the feature ships
cannot be declared again. What a shipped custom style shows is changed
through its definitions instead: on HTML, the custom properties of the
feature’s stylesheet (--flm-cells-green and the three others); on the
recomposed LaTeX, the command \flmCellsKeys<name> (see the
rendering guide).
§Examples
A custom style orange, which a style definition host.orange colors
on HTML and a definition piece host.latex.orange on the recomposed
LaTeX:
use flm_core::stdlib::backends::{html, latex_recomposed};
use flm_core::stdlib::features::cells::{CellStyle, Effect, StyleForm};
let orange = CellStyle::custom("orange", "an orange background")
.requires(html::BACKEND, ["host.orange"])
.requires(latex_recomposed::BACKEND, ["host.latex.orange"]);
assert_eq!(orange.form, StyleForm::Fixed(Effect::Custom));
assert_eq!(orange.requirements_on(html::BACKEND).count(), 1);Fields§
§name: NameThe token’s name: ASCII letters and digits, beginning with a letter. A custom style’s name is lowercase, since it becomes part of the name of an HTML attribute, which HTML reads without regard to case.
docs: StringWhat the style does, as a sentence, for generated reference
documentation. The constructors (fixed,
custom, structural)
leave it empty when the crate is built without its cargo feature docs.
form: StyleFormHow the token is written and what it states.
requires: Vec<StyleRequirement>The definitions each backend needs where a cell carries the style. The rule that lowers a table requires those of the backend it runs on, and none of any other backend.
Implementations§
Source§impl CellStyle
impl CellStyle
Sourcepub fn fixed(
name: impl Into<Name>,
docs: impl Into<String>,
effect: Effect,
) -> CellStyle
pub fn fixed( name: impl Into<Name>, docs: impl Into<String>, effect: Effect, ) -> CellStyle
A cell style of the fixed form, stating effect and requiring
nothing.
Sourcepub fn custom(name: impl Into<Name>, docs: impl Into<String>) -> CellStyle
pub fn custom(name: impl Into<Name>, docs: impl Into<String>) -> CellStyle
A custom style: a cell style of the fixed form that the cell carries
by its name (Effect::Custom), requiring nothing yet; add its
definitions with requires.
Sourcepub fn structural(
name: impl Into<Name>,
docs: impl Into<String>,
parameter: Parameter,
) -> CellStyle
pub fn structural( name: impl Into<Name>, docs: impl Into<String>, parameter: Parameter, ) -> CellStyle
A cell style of the structural form, which reads its value through
parameter.
Sourcepub fn requires(
self,
backend: impl Into<BackendName>,
ids: impl IntoIterator<Item = impl Into<Name>>,
) -> CellStyle
pub fn requires( self, backend: impl Into<BackendName>, ids: impl IntoIterator<Item = impl Into<Name>>, ) -> CellStyle
Builder: adds the definitions ids, which backend needs where a
cell carries the style.
Sourcepub fn requirements_on<'s>(
&'s self,
backend: &'s str,
) -> impl Iterator<Item = &'s Name> + 's
pub fn requirements_on<'s>( &'s self, backend: &'s str, ) -> impl Iterator<Item = &'s Name> + 's
The identifiers of the definitions backend needs where a cell
carries the style, in order.
Trait Implementations§
impl Eq for CellStyle
impl StructuralPartialEq for CellStyle
Auto Trait Implementations§
impl Forget for CellStyle
impl Freeze for CellStyle
impl Move for CellStyle
impl RefUnwindSafe for CellStyle
impl Send for CellStyle
impl Sync for CellStyle
impl Unpin for CellStyle
impl UnsafeUnpin for CellStyle
impl UnwindSafe for CellStyle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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