pub enum ForeignCallParam<F> {
Single(F),
Array(Vec<F>),
}Expand description
Single input or output of a foreign call.
This enum can represent either a single field element or an array of field elements.
The #[serde(untagged)] attribute uses the natural JSON representation:
Single(5) serializes as 5, and Array([1,2,3]) serializes as [1,2,3].
This allows external systems to pass values directly without needing to know about
Rust enum variants, relying on JSON’s native distinction between single values and arrays.
Variants§
Single(F)
A single field element value.
Array(Vec<F>)
Multiple field element values (array or vector passed by value).
Implementations§
Source§impl<F: AcirField> ForeignCallParam<F>
impl<F: AcirField> ForeignCallParam<F>
Sourcepub fn fields(&self) -> Vec<F>
pub fn fields(&self) -> Vec<F>
Convert the parameter into a uniform vector representation.
This is useful for flattening data when processing foreign call results,
allowing both Single and Array variants to be handled uniformly as Vec<F>.
Sourcepub fn unwrap_field(&self) -> F
pub fn unwrap_field(&self) -> F
Unwrap the field in a Single input. Panics if it’s an Array.
Trait Implementations§
Source§impl<F: Clone> Clone for ForeignCallParam<F>
impl<F: Clone> Clone for ForeignCallParam<F>
Source§fn clone(&self) -> ForeignCallParam<F>
fn clone(&self) -> ForeignCallParam<F>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<F: Debug> Debug for ForeignCallParam<F>
impl<F: Debug> Debug for ForeignCallParam<F>
Source§impl<'de, F> Deserialize<'de> for ForeignCallParam<F>where
F: Deserialize<'de>,
impl<'de, F> Deserialize<'de> for ForeignCallParam<F>where
F: Deserialize<'de>,
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<F> From<F> for ForeignCallParam<F>
impl<F> From<F> for ForeignCallParam<F>
Source§impl<F> From<Vec<F>> for ForeignCallParam<F>
impl<F> From<Vec<F>> for ForeignCallParam<F>
Source§impl<F: PartialEq> PartialEq for ForeignCallParam<F>
impl<F: PartialEq> PartialEq for ForeignCallParam<F>
Source§impl<F> Serialize for ForeignCallParam<F>where
F: Serialize,
impl<F> Serialize for ForeignCallParam<F>where
F: Serialize,
impl<F: Eq> Eq for ForeignCallParam<F>
impl<F> StructuralPartialEq for ForeignCallParam<F>
Auto Trait Implementations§
impl<F> Freeze for ForeignCallParam<F>where
F: Freeze,
impl<F> RefUnwindSafe for ForeignCallParam<F>where
F: RefUnwindSafe,
impl<F> Send for ForeignCallParam<F>where
F: Send,
impl<F> Sync for ForeignCallParam<F>where
F: Sync,
impl<F> Unpin for ForeignCallParam<F>where
F: Unpin,
impl<F> UnwindSafe for ForeignCallParam<F>where
F: UnwindSafe,
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