pub enum BudgetedStringError<R, E, Q = u64>{
Budget(InsufficientBudgetError<R, Q>),
Allocation(TryReserveError),
Quantity {
resource: R,
source: QuantityConversionError,
},
Render(E),
InvalidUtf8(FromUtf8Error),
LengthOverflow,
}Expand description
Describes why a budgeted string rendering transaction failed.
§Type Parameters
R- Caller-defined resource identity retained by limits and errors.E- Error type returned by the caller-provided renderer.Q- Exact unsigned quantity used for measurements and accounting.
§Examples
use qubit_budget::BudgetedStringError;
let error = BudgetedStringError::<&str, &str>::Render("render failed");
assert!(matches!(error, BudgetedStringError::Render("render failed")));Variants§
Budget(InsufficientBudgetError<R, Q>)
The rendered prefix exceeded the remaining resource budget.
Tuple Fields
§
0: InsufficientBudgetError<R, Q>Exact resource, capacity, balance, and rejected request.
Allocation(TryReserveError)
The output buffer could not reserve the requested capacity.
Tuple Fields
§
0: TryReserveErrorAllocation failure returned by the output byte buffer.
Quantity
The rendered UTF-8 byte length cannot be represented by the budget quantity.
Fields
§
resource: RResource whose accounting required the conversion.
§
source: QuantityConversionErrorFailed quantity conversion.
Render(E)
The renderer returned an error unrelated to the budget writer.
Tuple Fields
§
0: EOriginal error returned by the caller-provided renderer.
InvalidUtf8(FromUtf8Error)
The renderer produced bytes that are not valid UTF-8.
Tuple Fields
§
0: FromUtf8ErrorUTF-8 conversion failure retaining the rendered bytes.
LengthOverflow
The rendered byte length overflowed usize.
Trait Implementations§
Source§impl<R, E, Q> Debug for BudgetedStringError<R, E, Q>
impl<R, E, Q> Debug for BudgetedStringError<R, E, Q>
Source§impl<R, E, Q> Display for BudgetedStringError<R, E, Q>
impl<R, E, Q> Display for BudgetedStringError<R, E, Q>
Source§impl<R, E, Q> Error for BudgetedStringError<R, E, Q>
impl<R, E, Q> Error for BudgetedStringError<R, E, Q>
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()
Auto Trait Implementations§
impl<R, E, Q> Freeze for BudgetedStringError<R, E, Q>
impl<R, E, Q> RefUnwindSafe for BudgetedStringError<R, E, Q>
impl<R, E, Q> Send for BudgetedStringError<R, E, Q>
impl<R, E, Q> Sync for BudgetedStringError<R, E, Q>
impl<R, E, Q> Unpin for BudgetedStringError<R, E, Q>
impl<R, E, Q> UnsafeUnpin for BudgetedStringError<R, E, Q>
impl<R, E, Q> UnwindSafe for BudgetedStringError<R, E, Q>
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