pub enum Observation<Q> {
Exact(Q),
AtLeast(Q),
}Expand description
A resource observation that may be exact or only a safe lower bound.
§Type Parameters
Q- Exact unsigned quantity used for measurements and accounting.
§Examples
use qubit_budget::Observation;
let observation = Observation::AtLeast(4_u64);
assert_eq!(observation.exact(), None);
assert_eq!(observation.lower_bound(), 4);Variants§
Exact(Q)
The measured quantity is exact.
Tuple Fields
§
0: QExact observed quantity.
AtLeast(Q)
The measured quantity is at least the contained lower bound.
Tuple Fields
§
0: QProven lower bound for the observed quantity.
Implementations§
Source§impl<Q> Observation<Q>
impl<Q> Observation<Q>
Sourcepub const fn exact(self) -> Option<Q>
pub const fn exact(self) -> Option<Q>
Returns the exact quantity, or None for a lower-bound observation.
§Returns
Returns the exact quantity, or None for a lower-bound observation.
Sourcepub const fn lower_bound(self) -> Q
pub const fn lower_bound(self) -> Q
Returns the safe lower bound represented by this observation.
§Returns
Returns the safe lower bound represented by this observation.
Trait Implementations§
Source§impl<Q: Clone> Clone for Observation<Q>
impl<Q: Clone> Clone for Observation<Q>
Source§fn clone(&self) -> Observation<Q>
fn clone(&self) -> Observation<Q>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<Q: Copy> Copy for Observation<Q>
Source§impl<Q: Debug> Debug for Observation<Q>
impl<Q: Debug> Debug for Observation<Q>
Source§impl<Q> Display for Observation<Q>where
Q: Display,
impl<Q> Display for Observation<Q>where
Q: Display,
Source§fn fmt(&self, formatter: &mut Formatter<'_>) -> FmtResult
fn fmt(&self, formatter: &mut Formatter<'_>) -> FmtResult
Formats the observation with its precision qualifier.
§Parameters
formatter- Formatter receiving the textual representation.
§Returns
Formats the observation with its precision qualifier.
§Errors
Returns std::fmt::Error when the formatter rejects the output.
impl<Q: Eq> Eq for Observation<Q>
Source§impl<Q: Hash> Hash for Observation<Q>
impl<Q: Hash> Hash for Observation<Q>
Source§impl<Q: PartialEq> PartialEq for Observation<Q>
impl<Q: PartialEq> PartialEq for Observation<Q>
impl<Q: PartialEq> StructuralPartialEq for Observation<Q>
Auto Trait Implementations§
impl<Q> Freeze for Observation<Q>where
Q: Freeze,
impl<Q> RefUnwindSafe for Observation<Q>where
Q: RefUnwindSafe,
impl<Q> Send for Observation<Q>where
Q: Send,
impl<Q> Sync for Observation<Q>where
Q: Sync,
impl<Q> Unpin for Observation<Q>where
Q: Unpin,
impl<Q> UnsafeUnpin for Observation<Q>where
Q: UnsafeUnpin,
impl<Q> UnwindSafe for Observation<Q>where
Q: UnwindSafe,
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