Skip to main content

ArgumentValue

Enum ArgumentValue 

Source
#[non_exhaustive]
pub enum ArgumentValue { Signed(i128), Unsigned(u128), Float32(u32), Float64(u64), Duration(Duration), }
Expand description

A scalar value captured for a validation constraint or error.

Floating-point values are stored as raw IEEE 754 bits, so equality and hashing preserve distinctions such as signed zero and NaN payloads. Duration values retain their exact seconds and nanoseconds. Formatting reconstructs floats and preserves unit-bearing duration diagnostics.

This enum is non-exhaustive. Downstream matches must include a wildcard arm so future scalar representations can be added without a breaking release.

use qubit_argument::ArgumentValue;

fn classify(value: ArgumentValue) -> &'static str {
    match value {
        ArgumentValue::Signed(_) => "signed",
        ArgumentValue::Unsigned(_) => "unsigned",
        ArgumentValue::Float32(_) => "f32",
        ArgumentValue::Float64(_) => "f64",
        ArgumentValue::Duration(_) => "duration",
    }
}

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.
§

Signed(i128)

A signed integer represented without loss.

§

Unsigned(u128)

An unsigned integer represented without loss.

§

Float32(u32)

The raw bits of a 32-bit floating-point value.

§

Float64(u64)

The raw bits of a 64-bit floating-point value.

§

Duration(Duration)

An exact standard-library duration value.

Trait Implementations§

Source§

impl Clone for ArgumentValue

Source§

fn clone(&self) -> ArgumentValue

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 ArgumentValue

Source§

impl Debug for ArgumentValue

Source§

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

Formats the variant with its reconstructed scalar value.

Source§

impl Display for ArgumentValue

Source§

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

Formats the represented scalar value without a variant label.

Source§

impl Eq for ArgumentValue

Source§

impl From<Duration> for ArgumentValue

Source§

fn from(value: Duration) -> Self

Captures an exact standard-library duration value.

Source§

impl From<f32> for ArgumentValue

Source§

fn from(value: f32) -> Self

Captures the exact IEEE 754 bit pattern of a 32-bit float.

Source§

impl From<f64> for ArgumentValue

Source§

fn from(value: f64) -> Self

Captures the exact IEEE 754 bit pattern of a 64-bit float.

Source§

impl From<i8> for ArgumentValue

Source§

fn from(value: i8) -> Self

Converts a signed primitive integer without losing its value.

Source§

impl From<i16> for ArgumentValue

Source§

fn from(value: i16) -> Self

Converts a signed primitive integer without losing its value.

Source§

impl From<i32> for ArgumentValue

Source§

fn from(value: i32) -> Self

Converts a signed primitive integer without losing its value.

Source§

impl From<i64> for ArgumentValue

Source§

fn from(value: i64) -> Self

Converts a signed primitive integer without losing its value.

Source§

impl From<i128> for ArgumentValue

Source§

fn from(value: i128) -> Self

Converts a signed primitive integer without losing its value.

Source§

impl From<isize> for ArgumentValue

Source§

fn from(value: isize) -> Self

Converts a signed primitive integer without losing its value.

Source§

impl From<u8> for ArgumentValue

Source§

fn from(value: u8) -> Self

Converts an unsigned primitive integer without losing its value.

Source§

impl From<u16> for ArgumentValue

Source§

fn from(value: u16) -> Self

Converts an unsigned primitive integer without losing its value.

Source§

impl From<u32> for ArgumentValue

Source§

fn from(value: u32) -> Self

Converts an unsigned primitive integer without losing its value.

Source§

impl From<u64> for ArgumentValue

Source§

fn from(value: u64) -> Self

Converts an unsigned primitive integer without losing its value.

Source§

impl From<u128> for ArgumentValue

Source§

fn from(value: u128) -> Self

Converts an unsigned primitive integer without losing its value.

Source§

impl From<usize> for ArgumentValue

Source§

fn from(value: usize) -> Self

Converts an unsigned primitive integer without losing its value.

Source§

impl Hash for ArgumentValue

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 ArgumentValue

Source§

fn eq(&self, other: &ArgumentValue) -> 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 ArgumentValue

Auto Trait Implementations§

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.