Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 20 variants InvalidBounds { min: Level, max: Level, }, BudgetExhausted { limit: usize, }, BeforeStart { at: Tick, start: Tick, }, EmptyInterval { start: Tick, end: Tick, }, NonPositiveAmount { amount: Level, }, KindMismatch, Overflow, OutOfMemory, CapacityExceeded { container: Container, capacity: usize, }, InvalidWindow { earliest: Tick, latest: Tick, }, BufferTooSmall { needed: usize, }, Malformed, ChecksumMismatch, UnsupportedVersion { version: u8, }, InvalidStep { step: Tick, }, UnknownResource, UnknownActivity { activity: ActivityId, }, InconsistentPrecedences, NegativeDuration { shortest: Tick, }, SearchExhausted { checks: usize, },
}
Expand description

Why a timeline could not be built, an impact was rejected, or a check could not finish.

None of these is a resource violation. A violation is a successful check result, see Violation.

The enum is #[non_exhaustive]: new failure modes (for example of future checks) are added without a breaking release, so a match needs a wildcard arm. Callers that only need the distinction “retry with more room” versus “malformed input” can use is_capacity.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

InvalidBounds

The lower bound is greater than the upper bound, or a claimable capacity is negative.

Fields

§min: Level

The requested lower bound.

§max: Level

The requested upper bound.

§

BudgetExhausted

The timeline already holds as many impacts as its budget allows.

Fields

§limit: usize

The impact budget the timeline was created with.

§

BeforeStart

An impact starts before the timeline start.

Fields

§at: Tick

The first tick of the rejected impact.

§start: Tick

The start tick of the timeline.

§

EmptyInterval

A claim or rate interval [start, end) is empty or inverted.

Fields

§start: Tick

The requested first tick.

§end: Tick

The requested end tick.

§

NonPositiveAmount

A claim amount is zero or negative.

Fields

§amount: Level

The rejected amount.

§

KindMismatch

A step or rate impact was added to a claimable timeline, which accepts claims only.

§

Overflow

An intermediate sum, or the level at the first violation, does not fit the number range.

§

OutOfMemory

Memory for the impact list or the check could not be allocated.

§

CapacityExceeded

A fixed-capacity container is full.

Only fixed-capacity storage (Fixed, FixedPlan) reports this; heap storage reports OutOfMemory instead. The operation that failed left its target unchanged.

Fields

§container: Container

Which container ran out of room.

§capacity: usize

The fixed capacity of that container, in elements.

§

InvalidWindow

A start window has earliest > latest.

Fields

§earliest: Tick

The requested earliest start.

§latest: Tick

The requested latest start.

§

BufferTooSmall

An output buffer is too short for an encoding.

Fields

§needed: usize

The number of bytes the encoding needs.

§

Malformed

Encoded bytes have the wrong magic, length or content.

§

ChecksumMismatch

Encoded bytes do not match their checksum.

§

UnsupportedVersion

Encoded bytes use a format version this build does not read.

Fields

§version: u8

The version found.

§

InvalidStep

A sampling step is zero or negative.

Fields

§step: Tick

The rejected step.

§

UnknownResource

A demand names a timeline that is not part of the plan.

§

UnknownActivity

A precedence names an activity that is not part of the envelope.

Fields

§activity: ActivityId

The unknown activity.

§

InconsistentPrecedences

The start windows and precedences of an envelope admit no schedule at all.

§

NegativeDuration

A duration range of an activity starts below zero.

Fields

§shortest: Tick

The requested shortest duration.

§

SearchExhausted

A search ran out of its caller-chosen number of candidate checks before it found an answer.

Fields

§checks: usize

The number of candidate checks the search was allowed.

Implementations§

Source§

impl Error

Source

pub const fn is_capacity(&self) -> bool

Whether the error means “no room”: OutOfMemory, CapacityExceeded or BudgetExhausted.

These depend on the chosen limits, not on the input being malformed, so a caller may retry with larger limits or shed load.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Error

Source§

impl Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Error

Source§

impl Error for Error

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Replaced by Error::source.
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl Hash for Error

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Error

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl Forget for Error

§

impl Freeze for Error

§

impl Move for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.