#[non_exhaustive]pub enum ChargeError {
Limit(LimitError),
Budget(BudgetExceeded),
Allocator(AllocError),
}Expand description
A charge the meter or the budget refused. Nothing was allocated.
Callers must leave room for future refusal kinds.
ⓘ
use unityrs_core::limits::ChargeError;
fn classify(error: ChargeError) {
match error {
ChargeError::Limit(_) => {},
ChargeError::Budget(_) => {},
ChargeError::Allocator(_) => {},
}
}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.
Limit(LimitError)
The input’s own bound (Limits::max_input_memory, or a buffer’s
cap such as Limits::max_block_output).
Budget(BudgetExceeded)
The shared budget refused, or the allocator failed.
Allocator(AllocError)
The host allocator refused storage after any charge was granted.
Implementations§
Source§impl ChargeError
impl ChargeError
Sourcepub fn is_transient(&self) -> bool
pub fn is_transient(&self) -> bool
Whether the refusal depends on what else is held (a budget, or the
input’s meter), not on the input alone (crate::once).
Sourcepub fn is_meter_refusal(&self) -> bool
pub fn is_meter_refusal(&self) -> bool
Whether the input’s own meter refused (LimitKind::InputMemory),
not the budget (crate::once::CellError::is_meter_refusal).
Trait Implementations§
Source§impl Clone for ChargeError
impl Clone for ChargeError
Source§impl Debug for ChargeError
impl Debug for ChargeError
Source§impl Display for ChargeError
impl Display for ChargeError
impl Eq for ChargeError
Source§impl Error for ChargeError
impl Error for ChargeError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<AllocError> for ChargeError
impl From<AllocError> for ChargeError
Source§fn from(source: AllocError) -> Self
fn from(source: AllocError) -> Self
Converts to this type from the input type.
Source§impl From<BudgetExceeded> for ChargeError
impl From<BudgetExceeded> for ChargeError
Source§fn from(source: BudgetExceeded) -> Self
fn from(source: BudgetExceeded) -> Self
Converts to this type from the input type.
Source§impl From<ChargeError> for UnityVersionFallbackError
impl From<ChargeError> for UnityVersionFallbackError
Source§fn from(source: ChargeError) -> Self
fn from(source: ChargeError) -> Self
Converts to this type from the input type.
Source§impl From<ChargeError> for Error
impl From<ChargeError> for Error
Source§fn from(e: ChargeError) -> Self
fn from(e: ChargeError) -> Self
Converts to this type from the input type.
Source§impl From<ChargeError> for SaveError
impl From<ChargeError> for SaveError
Source§fn from(source: ChargeError) -> Self
fn from(source: ChargeError) -> Self
Converts to this type from the input type.
Source§impl From<ChargeError> for ViewError
impl From<ChargeError> for ViewError
Source§fn from(source: ChargeError) -> Self
fn from(source: ChargeError) -> Self
Converts to this type from the input type.
Source§impl From<ChargeError> for FromListError
impl From<ChargeError> for FromListError
Source§fn from(e: ChargeError) -> Self
fn from(e: ChargeError) -> Self
Converts to this type from the input type.
Source§impl From<ChargeError> for TreeError
impl From<ChargeError> for TreeError
Source§fn from(source: ChargeError) -> Self
fn from(source: ChargeError) -> Self
Converts to this type from the input type.
Source§impl From<LimitError> for ChargeError
impl From<LimitError> for ChargeError
Source§fn from(source: LimitError) -> Self
fn from(source: LimitError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ChargeError
impl PartialEq for ChargeError
impl StructuralPartialEq for ChargeError
Auto Trait Implementations§
impl Forget for ChargeError
impl Freeze for ChargeError
impl Move for ChargeError
impl RefUnwindSafe for ChargeError
impl Send for ChargeError
impl Sync for ChargeError
impl Unpin for ChargeError
impl UnsafeUnpin for ChargeError
impl UnwindSafe for ChargeError
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
Mutably borrows from an owned value. Read more