pub struct EnumElem {
pub children: Vec<Packed<EnumItem>>,
/* private fields */
}
Expand description
A numbered list.
Displays a sequence of items vertically and numbers them consecutively.
§Example
Automatically numbered:
+ Preparations
+ Analysis
+ Conclusions
Manually numbered:
2. What is the first step?
5. I am confused.
+ Moving on ...
Multiple lines:
+ This enum item has multiple
lines because the next line
is indented.
Function call.
#enum[First][Second]
You can easily switch all your enumerations to a different numbering style with a set rule.
#set enum(numbering: "a)")
+ Starting off ...
+ Don't forget step two
You can also use enum.item
to programmatically customize the
number of each item in the enumeration:
#enum(
enum.item(1)[First step],
enum.item(5)[Fifth step],
enum.item(10)[Tenth step]
)
§Syntax
This functions also has dedicated syntax:
- Starting a line with a plus sign creates an automatically numbered enumeration item.
- Starting a line with a number followed by a dot creates an explicitly numbered enumeration item.
Enumeration items can contain multiple paragraphs and other block-level content. All content that is indented more than an item’s marker becomes part of that item.
Fields§
§children: Vec<Packed<EnumItem>>
Implementations§
Source§impl EnumElem
impl EnumElem
Sourcepub fn with_tight(self, tight: bool) -> EnumElem
pub fn with_tight(self, tight: bool) -> EnumElem
Builder-style setter for the tight
field.
Sourcepub fn with_numbering(self, numbering: Numbering) -> EnumElem
pub fn with_numbering(self, numbering: Numbering) -> EnumElem
Builder-style setter for the numbering
field.
Sourcepub fn with_start(self, start: Smart<usize>) -> EnumElem
pub fn with_start(self, start: Smart<usize>) -> EnumElem
Builder-style setter for the start
field.
Sourcepub fn with_reversed(self, reversed: bool) -> EnumElem
pub fn with_reversed(self, reversed: bool) -> EnumElem
Builder-style setter for the reversed
field.
Sourcepub fn with_indent(self, indent: Length) -> EnumElem
pub fn with_indent(self, indent: Length) -> EnumElem
Builder-style setter for the indent
field.
Sourcepub fn with_body_indent(self, body_indent: Length) -> EnumElem
pub fn with_body_indent(self, body_indent: Length) -> EnumElem
Builder-style setter for the body-indent
field.
Sourcepub fn with_spacing(self, spacing: Smart<Length>) -> EnumElem
pub fn with_spacing(self, spacing: Smart<Length>) -> EnumElem
Builder-style setter for the spacing
field.
Sourcepub fn with_number_align(self, number_align: Alignment) -> EnumElem
pub fn with_number_align(self, number_align: Alignment) -> EnumElem
Builder-style setter for the number-align
field.
Sourcepub fn push_tight(&mut self, tight: bool)
pub fn push_tight(&mut self, tight: bool)
Setter for the tight
field.
Sourcepub fn push_numbering(&mut self, numbering: Numbering)
pub fn push_numbering(&mut self, numbering: Numbering)
Setter for the numbering
field.
Sourcepub fn push_start(&mut self, start: Smart<usize>)
pub fn push_start(&mut self, start: Smart<usize>)
Setter for the start
field.
Sourcepub fn push_reversed(&mut self, reversed: bool)
pub fn push_reversed(&mut self, reversed: bool)
Setter for the reversed
field.
Sourcepub fn push_indent(&mut self, indent: Length)
pub fn push_indent(&mut self, indent: Length)
Setter for the indent
field.
Sourcepub fn push_body_indent(&mut self, body_indent: Length)
pub fn push_body_indent(&mut self, body_indent: Length)
Setter for the body-indent
field.
Sourcepub fn push_spacing(&mut self, spacing: Smart<Length>)
pub fn push_spacing(&mut self, spacing: Smart<Length>)
Setter for the spacing
field.
Sourcepub fn push_number_align(&mut self, number_align: Alignment)
pub fn push_number_align(&mut self, number_align: Alignment)
Setter for the number-align
field.
Sourcepub fn tight(&self, styles: StyleChain<'_>) -> bool
pub fn tight(&self, styles: StyleChain<'_>) -> bool
Defines the default spacing of the enumeration. If it
is {false}
, the items are spaced apart with
paragraph spacing. If it is {true}
, they use
paragraph leading instead. This makes the list more
compact, which can look better if the items are short.
In markup mode, the value of this parameter is determined based on
whether items are separated with a blank line. If items directly follow
each other, this is set to {true}
; if items are separated by a blank
line, this is set to {false}
. The markup-defined tightness cannot be
overridden with set rules.
+ If an enum has a lot of text, and
maybe other inline content, it
should not be tight anymore.
+ To make an enum wide, simply
insert a blank line between the
items.
Sourcepub fn numbering<'a>(&'a self, styles: StyleChain<'a>) -> &'a Numbering
pub fn numbering<'a>(&'a self, styles: StyleChain<'a>) -> &'a Numbering
How to number the enumeration. Accepts a numbering pattern or function.
If the numbering pattern contains multiple counting symbols, they apply
to nested enums. If given a function, the function receives one argument
if full
is {false}
and multiple arguments if full
is {true}
.
#set enum(numbering: "1.a)")
+ Different
+ Numbering
+ Nested
+ Items
+ Style
#set enum(numbering: n => super[#n])
+ Superscript
+ Numbering!
Sourcepub fn start(&self, styles: StyleChain<'_>) -> Smart<usize>
pub fn start(&self, styles: StyleChain<'_>) -> Smart<usize>
Which number to start the enumeration with.
#enum(
start: 3,
[Skipping],
[Ahead],
)
Sourcepub fn full(&self, styles: StyleChain<'_>) -> bool
pub fn full(&self, styles: StyleChain<'_>) -> bool
Whether to display the full numbering, including the numbers of all parent enumerations.
#set enum(numbering: "1.a)", full: true)
+ Cook
+ Heat water
+ Add ingredients
+ Eat
Sourcepub fn reversed(&self, styles: StyleChain<'_>) -> bool
pub fn reversed(&self, styles: StyleChain<'_>) -> bool
Whether to reverse the numbering for this enumeration.
#set enum(reversed: true)
+ Coffee
+ Tea
+ Milk
Sourcepub fn indent(&self, styles: StyleChain<'_>) -> <Length as Resolve>::Output
pub fn indent(&self, styles: StyleChain<'_>) -> <Length as Resolve>::Output
The indentation of each item.
Sourcepub fn body_indent(&self, styles: StyleChain<'_>) -> <Length as Resolve>::Output
pub fn body_indent(&self, styles: StyleChain<'_>) -> <Length as Resolve>::Output
The space between the numbering and the body of each item.
Sourcepub fn spacing(&self, styles: StyleChain<'_>) -> Smart<Length>
pub fn spacing(&self, styles: StyleChain<'_>) -> Smart<Length>
Sourcepub fn number_align(&self, styles: StyleChain<'_>) -> Alignment
pub fn number_align(&self, styles: StyleChain<'_>) -> Alignment
The alignment that enum numbers should have.
By default, this is set to {end + top}
, which aligns enum numbers
towards end of the current text direction (in left-to-right script,
for example, this is the same as {right}
) and at the top of the line.
The choice of {end}
for horizontal alignment of enum numbers is
usually preferred over {start}
, as numbers then grow away from the
text instead of towards it, avoiding certain visual issues. This option
lets you override this behaviour, however. (Also to note is that the
unordered list uses a different method for this, by giving the
marker
content an alignment directly.).
#set enum(number-align: start + bottom)
Here are some powers of two:
1. One
2. Two
4. Four
8. Eight
16. Sixteen
32. Thirty two
Sourcepub fn tight_in(styles: StyleChain<'_>) -> bool
pub fn tight_in(styles: StyleChain<'_>) -> bool
Access the tight
field in the given style chain.
Sourcepub fn numbering_in(styles: StyleChain<'_>) -> &Numbering
pub fn numbering_in(styles: StyleChain<'_>) -> &Numbering
Access the numbering
field in the given style chain.
Sourcepub fn start_in(styles: StyleChain<'_>) -> Smart<usize>
pub fn start_in(styles: StyleChain<'_>) -> Smart<usize>
Access the start
field in the given style chain.
Sourcepub fn full_in(styles: StyleChain<'_>) -> bool
pub fn full_in(styles: StyleChain<'_>) -> bool
Access the full
field in the given style chain.
Sourcepub fn reversed_in(styles: StyleChain<'_>) -> bool
pub fn reversed_in(styles: StyleChain<'_>) -> bool
Access the reversed
field in the given style chain.
Sourcepub fn indent_in(styles: StyleChain<'_>) -> <Length as Resolve>::Output
pub fn indent_in(styles: StyleChain<'_>) -> <Length as Resolve>::Output
Access the indent
field in the given style chain.
Sourcepub fn body_indent_in(styles: StyleChain<'_>) -> <Length as Resolve>::Output
pub fn body_indent_in(styles: StyleChain<'_>) -> <Length as Resolve>::Output
Access the body-indent
field in the given style chain.
Sourcepub fn spacing_in(styles: StyleChain<'_>) -> Smart<Length>
pub fn spacing_in(styles: StyleChain<'_>) -> Smart<Length>
Access the spacing
field in the given style chain.
Sourcepub fn number_align_in(styles: StyleChain<'_>) -> Alignment
pub fn number_align_in(styles: StyleChain<'_>) -> Alignment
Access the number-align
field in the given style chain.
Sourcepub fn parents_in(styles: StyleChain<'_>) -> SmallVec<[usize; 4]>
pub fn parents_in(styles: StyleChain<'_>) -> SmallVec<[usize; 4]>
Access the parents
field in the given style chain.
Sourcepub fn set_numbering(numbering: Numbering) -> Property
pub fn set_numbering(numbering: Numbering) -> Property
Create a style property for the numbering
field.
Sourcepub fn set_reversed(reversed: bool) -> Property
pub fn set_reversed(reversed: bool) -> Property
Create a style property for the reversed
field.
Sourcepub fn set_indent(indent: Length) -> Property
pub fn set_indent(indent: Length) -> Property
Create a style property for the indent
field.
Sourcepub fn set_body_indent(body_indent: Length) -> Property
pub fn set_body_indent(body_indent: Length) -> Property
Create a style property for the body-indent
field.
Sourcepub fn set_spacing(spacing: Smart<Length>) -> Property
pub fn set_spacing(spacing: Smart<Length>) -> Property
Create a style property for the spacing
field.
Sourcepub fn set_number_align(number_align: Alignment) -> Property
pub fn set_number_align(number_align: Alignment) -> Property
Create a style property for the number-align
field.
Trait Implementations§
Source§impl Fields for EnumElem
impl Fields for EnumElem
Source§fn field(&self, id: u8) -> Result<Value, FieldAccessError>
fn field(&self, id: u8) -> Result<Value, FieldAccessError>
Source§fn field_with_styles(
&self,
id: u8,
styles: StyleChain<'_>,
) -> Result<Value, FieldAccessError>
fn field_with_styles( &self, id: u8, styles: StyleChain<'_>, ) -> Result<Value, FieldAccessError>
Source§fn field_from_styles(
id: u8,
styles: StyleChain<'_>,
) -> Result<Value, FieldAccessError>
fn field_from_styles( id: u8, styles: StyleChain<'_>, ) -> Result<Value, FieldAccessError>
Source§fn materialize(&mut self, styles: StyleChain<'_>)
fn materialize(&mut self, styles: StyleChain<'_>)
Source§impl NativeElement for EnumElem
impl NativeElement for EnumElem
Source§impl NativeScope for EnumElem
impl NativeScope for EnumElem
Source§fn constructor() -> Option<&'static NativeFuncData>
fn constructor() -> Option<&'static NativeFuncData>
Auto Trait Implementations§
impl Freeze for EnumElem
impl !RefUnwindSafe for EnumElem
impl Send for EnumElem
impl Sync for EnumElem
impl Unpin for EnumElem
impl !UnwindSafe for EnumElem
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters
when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.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<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle
.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other
into Self
, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T
.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters
when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
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 moreSource§impl<T> IntoResult for Twhere
T: IntoValue,
impl<T> IntoResult for Twhere
T: IntoValue,
Source§fn into_result(self, _: Span) -> Result<Value, EcoVec<SourceDiagnostic>>
fn into_result(self, _: Span) -> Result<Value, EcoVec<SourceDiagnostic>>
Source§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self
into T
, while performing the appropriate scaling,
rounding and clamping.Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors
fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains
the unclamped color. Read more