summaryrefslogtreecommitdiff
path: root/library/src/layout/enum.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-03-27 11:58:17 +0200
committerLaurenz <laurmaedje@gmail.com>2023-03-27 12:12:57 +0200
commita5c88c19b300c64fafd6a19e3f5f2fe6422a7b67 (patch)
tree42192332e277624a35c6e3db568c0ff8196b582a /library/src/layout/enum.rs
parent10d8fd966130f1e60d328b08a7fcce61961d6974 (diff)
Fix enum parsing and allow zero in numberings
Fixes #353.
Diffstat (limited to 'library/src/layout/enum.rs')
-rw-r--r--library/src/layout/enum.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/library/src/layout/enum.rs b/library/src/layout/enum.rs
index 1be57d4c..ec4fbc18 100644
--- a/library/src/layout/enum.rs
+++ b/library/src/layout/enum.rs
@@ -100,8 +100,8 @@ pub struct EnumElem {
/// [Ahead],
/// )
/// ```
- #[default(NonZeroUsize::ONE)]
- pub start: NonZeroUsize,
+ #[default(1)]
+ pub start: usize,
/// Whether to display the full numbering, including the numbers of
/// all parent enumerations.
@@ -225,7 +225,7 @@ impl Layout for EnumElem {
pub struct EnumItem {
/// The item's number.
#[positional]
- pub number: Option<NonZeroUsize>,
+ pub number: Option<usize>,
/// The item's body.
#[required]
@@ -245,11 +245,11 @@ cast_from_value! {
v: Content => v.to::<Self>().cloned().unwrap_or_else(|| Self::new(v.clone())),
}
-struct Parent(NonZeroUsize);
+struct Parent(usize);
cast_from_value! {
Parent,
- v: NonZeroUsize => Self(v),
+ v: usize => Self(v),
}
cast_to_value! {
@@ -257,7 +257,7 @@ cast_to_value! {
}
impl Fold for Parent {
- type Output = Vec<NonZeroUsize>;
+ type Output = Vec<usize>;
fn fold(self, mut outer: Self::Output) -> Self::Output {
outer.push(self.0);