Skip to main content

InteropValue

Enum InteropValue 

Source
pub enum InteropValue {
    Null,
    Bool(bool),
    Int(i128),
    Float(f64),
    Str(String),
    Bytes(Vec<u8>),
    Array(Vec<InteropValue>),
    Map(BTreeMap<String, InteropValue>),
    Set(Vec<InteropValue>),
    DateTime {
        unix_micros: i64,
    },
    Uuid(Uuid),
}
Expand description

A value in the closed interop/v1 argument data model.

Anything outside this model is unrepresentable by construction; values that are representable but out of spec range (non-finite floats, integers outside [-2^63, 2^64-1]) are rejected with an error at encode time — never silently coerced.

Variants§

§

Null

msgpack nil.

§

Bool(bool)

msgpack bool.

§

Int(i128)

Integer. Must be within [-2^63, 2^64-1] (checked at encode time); i128 storage lets a single variant span the full signed+unsigned range.

§

Float(f64)

Float. Must be finite (NaN / ±Inf rejected at encode time). In the argument profile, integral floats within [-2^63, 2^64) collapse to the integer encoding, so 2.0 and 2 hash identically (spec: number canonicalization).

§

Str(String)

UTF-8 string, encoded as the msgpack str family. No Unicode normalization is applied. Rust strings are well-formed Unicode scalar sequences by construction, which the spec requires.

§

Bytes(Vec<u8>)

Byte string, encoded as the msgpack bin family (never str).

§

Array(Vec<InteropValue>)

Ordered sequence; elements normalized recursively.

§

Map(BTreeMap<String, InteropValue>)

String-keyed map. BTreeMap’s byte-wise key order is the spec’s Unicode-code-point order (UTF-8 byte order ≡ code point order), applied at every nesting level.

§

Set(Vec<InteropValue>)

Set: elements are normalized, encoded, sorted by their encoded bytes (unsigned lexicographic), and deduplicated post-normalization.

§

DateTime

Timezone-aware instant as microseconds since the Unix epoch.

Sub-microsecond precision must be floored toward negative infinity before construction. Encoding performs the spec’s single IEEE 754 float64 division by 10^6, so hashes are bit-deterministic across SDKs. Naive (offset-less) datetimes are unrepresentable in this API.

Fields

§unix_micros: i64

Microseconds since 1970-01-01T00:00:00Z (negative = pre-epoch).

§

Uuid(Uuid)

UUID, encoded as its lowercase hyphenated string form.

Implementations§

Source§

impl InteropValue

Source

pub fn bytes(bytes: impl Into<Vec<u8>>) -> Self

Build a byte string (msgpack bin).

Source

pub fn datetime_from_unix_micros(unix_micros: i64) -> Self

Build a timezone-aware datetime from microseconds since the Unix epoch.

Trait Implementations§

Source§

impl Clone for InteropValue

Source§

fn clone(&self) -> InteropValue

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 Debug for InteropValue

Source§

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

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

impl From<&str> for InteropValue

Source§

fn from(v: &str) -> Self

Converts to this type from the input type.
Source§

impl From<BTreeMap<String, InteropValue>> for InteropValue

Source§

fn from(v: BTreeMap<String, InteropValue>) -> Self

Converts to this type from the input type.
Source§

impl From<String> for InteropValue

Source§

fn from(v: String) -> Self

Converts to this type from the input type.
Source§

impl From<Uuid> for InteropValue

Source§

fn from(v: Uuid) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<InteropValue>> for InteropValue

Source§

fn from(v: Vec<InteropValue>) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for InteropValue

Source§

fn from(v: bool) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for InteropValue

Source§

fn from(v: f64) -> Self

Finiteness is checked at encode time, not construction time.

Source§

impl From<i32> for InteropValue

Source§

fn from(v: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for InteropValue

Source§

fn from(v: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i128> for InteropValue

Source§

fn from(v: i128) -> Self

Range is checked at encode time, not construction time.

Source§

impl From<u32> for InteropValue

Source§

fn from(v: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for InteropValue

Source§

fn from(v: u64) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for InteropValue

Source§

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

Source§

impl TryFrom<SystemTime> for InteropValue

Source§

fn try_from(t: SystemTime) -> Result<Self, CachekitError>

Convert an instant to interop datetime micros, flooring sub-microsecond precision toward negative infinity (spec rule — truncation toward zero would differ for pre-epoch instants).

Source§

type Error = CachekitError

The type returned in the event of a conversion error.

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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, 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more