pub struct AcceptanceContract {
pub lo: i64,
pub hi: i64,
}Expand description
A receiver-declared acceptance contract: a single integer parameter accepted only within
[lo, hi] (inclusive), returning an integer. The bound is what the receiver promises to
honor; anything outside is refused at the seam.
Fields§
§lo: i64§hi: i64Implementations§
Source§impl AcceptanceContract
impl AcceptanceContract
pub fn new(lo: i64, hi: i64) -> Self
Sourcepub fn apply(&self, function: &RuntimeValue, arg: i64) -> Result<i64, String>
pub fn apply(&self, function: &RuntimeValue, arg: i64) -> Result<i64, String>
Validate function and arg against this contract, then evaluate. The two failure
modes are distinct and both surface as Err:
- signature —
functionmust be a shipped pure computation (generated) of exactly one argument. An ordinary closure (arena body) or a wrong arity is refused; the contract only ever runs the bounded sandbox, never interpreter-resident code. - range —
argmust satisfylo ≤ arg ≤ hi. Out-of-range is refused, NOT clamped: the receiver asked for a bounded domain, so an out-of-domain input is an error at the edge, not a quietly-different computation.
Trait Implementations§
Source§impl Clone for AcceptanceContract
impl Clone for AcceptanceContract
Source§fn clone(&self) -> AcceptanceContract
fn clone(&self) -> AcceptanceContract
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 AcceptanceContract
impl Debug for AcceptanceContract
Source§impl PartialEq for AcceptanceContract
impl PartialEq for AcceptanceContract
Source§fn eq(&self, other: &AcceptanceContract) -> bool
fn eq(&self, other: &AcceptanceContract) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for AcceptanceContract
impl Eq for AcceptanceContract
impl StructuralPartialEq for AcceptanceContract
Auto Trait Implementations§
impl Freeze for AcceptanceContract
impl RefUnwindSafe for AcceptanceContract
impl Send for AcceptanceContract
impl Sync for AcceptanceContract
impl Unpin for AcceptanceContract
impl UnsafeUnpin for AcceptanceContract
impl UnwindSafe for AcceptanceContract
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.