pub enum Bound {
Pct(f64),
Frac(f64),
Ord(u64),
Star,
Fill,
StarSplit(u64),
StarShaped(Vec<f64>),
Gap(Box<Bound>),
}Expand description
One numeric boundary or list token inside a partition spec. The forms are distinguished syntactically at parse time:
- Trailing
%→Bound::Pct - Decimal in
[0.0, 1.0]→Bound::Frac - Bare integer →
Bound::Ord - Literal
*(or*%) →Bound::Star - Literal
...→Bound::Fill */N(bare integer N) →Bound::StarSplit
Bound::Pct and Bound::Frac are equivalent at resolve
time (the latter is just the former divided by 100); both
require a base extent. Bound::Ord is already absolute.
The tail tokens (Star, Fill, StarSplit, StarShaped)
are valid only inside a Form 2 delta list and at most one per
list. Star absorbs the remainder as a single partition;
Fill repeats the preceding delta until the extent is used
up; StarSplit(n) divides the remainder into n equal
partitions; StarShaped(weights) divides it by recipe
weights. Fill, StarSplit, and StarShaped must be the
final entry; Star may sit anywhere in the list. Gap
wraps a sized bound and consumes extent without emitting a
partition.
Variants§
Pct(f64)
Percentage of the cursor’s base extent, [0.0, 100.0].
Frac(f64)
Fraction of the cursor’s base extent, [0.0, 1.0].
Equivalent to Pct(value * 100).
Ord(u64)
Absolute cursor ordinal (already in ordinal space).
Star
Remainder marker — absorbs whatever’s needed for the containing delta list to span the cursor’s full extent, as one partition.
Fill
Fill marker (...) — repeats the preceding delta until
the extent is used up. A final chunk smaller than the
repeated delta is emitted truncated, never dropped.
StarSplit(u64)
Remainder split (*/N) — divides whatever’s left after
the other deltas into N partitions whose sizes differ
by at most one ordinal.
StarShaped(Vec<f64>)
Recipe-shaped remainder (*/fib:5, */ratios:1,3, …) —
divides whatever’s left by the recipe’s normalised
weights (stored summing to 100).
Gap(Box<Bound>)
Gap (~10%, ~1000) — consumes the wrapped sized
bound’s extent without emitting a partition. The walk
stays contiguous; the emitted partition set skips this
range. Parse guarantees the inner bound is sized
(Pct / Frac / Ord).
Implementations§
Source§impl Bound
impl Bound
Sourcepub fn resolve_against(&self, base_start: u64, base_end: u64) -> Option<u64>
pub fn resolve_against(&self, base_start: u64, base_end: u64) -> Option<u64>
Resolve this bound to an absolute ordinal in
[base_start, base_end] against a known extent. Returns
None for the tail tokens and gaps — their resolution
depends on list context and is the caller’s
responsibility.
Trait Implementations§
impl StructuralPartialEq for Bound
Auto Trait Implementations§
impl Freeze for Bound
impl RefUnwindSafe for Bound
impl Send for Bound
impl Sync for Bound
impl Unpin for Bound
impl UnsafeUnpin for Bound
impl UnwindSafe for Bound
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more