pub struct ContractValue { /* private fields */ }Expand description
A transport-neutral contract value with an invariant-preserving private representation.
All floating-point values are finite, so structural equality is reflexive
in practice. IEEE equality still treats 0.0 and -0.0 as equal.
Implementations§
Source§impl ContractValue
impl ContractValue
Sourcepub fn f32(value: f32) -> Result<Self, ValueError>
pub fn f32(value: f32) -> Result<Self, ValueError>
Constructs a finite 32-bit floating-point value.
Sourcepub fn f64(value: f64) -> Result<Self, ValueError>
pub fn f64(value: f64) -> Result<Self, ValueError>
Constructs a finite 64-bit floating-point value.
Sourcepub fn list(items: impl IntoIterator<Item = ContractValue>) -> Self
pub fn list(items: impl IntoIterator<Item = ContractValue>) -> Self
Constructs a list. Only contract values can be nested, so Missing
cannot appear inside a list.
ⓘ
use boxology_contract::{ContractValue, SlotValue};
let _ = ContractValue::list([SlotValue::Missing]);Sourcepub fn object(
entries: impl IntoIterator<Item = (String, ContractValue)>,
) -> Result<Self, ValueError>
pub fn object( entries: impl IntoIterator<Item = (String, ContractValue)>, ) -> Result<Self, ValueError>
Constructs an insertion-ordered object with unique keys. Object values
cannot be Missing because they are contract values rather than slots.
ⓘ
use boxology_contract::{ContractValue, SlotValue};
let _ = ContractValue::object([("key".into(), SlotValue::Missing)]);Sourcepub fn enum_value(tag: impl Into<String>, payload: SlotValue) -> Self
pub fn enum_value(tag: impl Into<String>, payload: SlotValue) -> Self
Constructs an enum node. A missing payload is legal at this call-slot boundary.
Sourcepub fn opaque(payload: OpaquePayload) -> Self
pub fn opaque(payload: OpaquePayload) -> Self
Constructs an opaque transport-neutral value.
Sourcepub fn sensitive(inner: ContractValue) -> Self
pub fn sensitive(inner: ContractValue) -> Self
Marks an entire value subtree as sensitive for diagnostic redaction.
Trait Implementations§
Source§impl Clone for ContractValue
impl Clone for ContractValue
Source§fn clone(&self) -> ContractValue
fn clone(&self) -> ContractValue
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 moreSource§impl Debug for ContractValue
impl Debug for ContractValue
Source§impl PartialEq for ContractValue
impl PartialEq for ContractValue
impl StructuralPartialEq for ContractValue
Auto Trait Implementations§
impl Freeze for ContractValue
impl RefUnwindSafe for ContractValue
impl Send for ContractValue
impl Sync for ContractValue
impl Unpin for ContractValue
impl UnsafeUnpin for ContractValue
impl UnwindSafe for ContractValue
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