pub enum ValueOrArray {
MemoryAddress(MemoryAddress),
HeapArray(HeapArray),
HeapVector(HeapVector),
}Expand description
Lays out various ways an external foreign call’s input and output data may be interpreted inside Brillig. This data can either be an individual value or memory.
While we are usually agnostic to how memory is passed within Brillig,
this needs to be encoded somehow when dealing with an external system.
For simplicity, the extra type information is given right in the ForeignCall instructions.
Variants§
MemoryAddress(MemoryAddress)
A single value to be passed to or from an external call. It is an ‘immediate’ value - used without dereferencing. For a foreign call input, the value is read directly from memory. For a foreign call output, the value is written directly to memory.
HeapArray(HeapArray)
An array to be passed to or from an external call.
In the case of a foreign call input, the array is read from this Brillig memory location + size more cells.
In the case of a foreign call output, the array is written to this Brillig memory location with the size being here just as a sanity check for the write size.
HeapVector(HeapVector)
A vector to be passed to or from an external call. In the case of a foreign call input, the vector is read from this Brillig memory location + as many cells as the second address indicates. In the case of a foreign call output, the vector is written to this Brillig memory location as ‘size’ cells, with size being stored in the second address.
Trait Implementations§
Source§impl Clone for ValueOrArray
impl Clone for ValueOrArray
Source§fn clone(&self) -> ValueOrArray
fn clone(&self) -> ValueOrArray
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ValueOrArray
impl Debug for ValueOrArray
Source§impl<'de> Deserialize<'de> for ValueOrArray
impl<'de> Deserialize<'de> for ValueOrArray
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for ValueOrArray
impl Display for ValueOrArray
Source§impl Hash for ValueOrArray
impl Hash for ValueOrArray
Source§impl PartialEq for ValueOrArray
impl PartialEq for ValueOrArray
Source§impl Serialize for ValueOrArray
impl Serialize for ValueOrArray
impl Copy for ValueOrArray
impl Eq for ValueOrArray
impl StructuralPartialEq for ValueOrArray
Auto Trait Implementations§
impl Freeze for ValueOrArray
impl RefUnwindSafe for ValueOrArray
impl Send for ValueOrArray
impl Sync for ValueOrArray
impl Unpin for ValueOrArray
impl UnwindSafe for ValueOrArray
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more