Struct snarkvm_wasm::program::Record
pub struct Record<N, Private>where
N: Network,
Private: Visibility,{ /* private fields */ }
Expand description
A value stored in program record.
Implementations
impl<N> Record<N, Ciphertext<N>>where
N: Network,
impl<N> Record<N, Ciphertext<N>>where
N: Network,
impl<N> Record<N, Plaintext<N>>where
N: Network,
impl<N> Record<N, Plaintext<N>>where
N: Network,
pub fn encrypt(
&self,
randomizer: Scalar<N>
) -> Result<Record<N, Ciphertext<N>>, Error>
pub fn encrypt(
&self,
randomizer: Scalar<N>
) -> Result<Record<N, Ciphertext<N>>, Error>
Encrypts self
for the record owner under the given randomizer.
pub fn encrypt_symmetric(
&self,
record_view_key: &Field<N>
) -> Result<Record<N, Ciphertext<N>>, Error>
pub fn encrypt_symmetric(
&self,
record_view_key: &Field<N>
) -> Result<Record<N, Ciphertext<N>>, Error>
Encrypts self
under the given record view key.
impl<N> Record<N, Ciphertext<N>>where
N: Network,
impl<N> Record<N, Ciphertext<N>>where
N: Network,
impl<N, Private> Record<N, Private>where
N: Network,
Private: Visibility,
impl<N, Private> Record<N, Private>where
N: Network,
Private: Visibility,
pub fn serial_number(
private_key: PrivateKey<N>,
commitment: Field<N>
) -> Result<Field<N>, Error>
pub fn serial_number(
private_key: PrivateKey<N>,
commitment: Field<N>
) -> Result<Field<N>, Error>
A helper method to derive the serial number from the private key and commitment.
impl<N, Private> Record<N, Private>where
N: Network,
Private: Visibility,
impl<N, Private> Record<N, Private>where
N: Network,
Private: Visibility,
impl<N> Record<N, Plaintext<N>>where
N: Network,
impl<N> Record<N, Plaintext<N>>where
N: Network,
pub fn to_commitment(
&self,
program_id: &ProgramID<N>,
record_name: &Identifier<N>
) -> Result<Field<N>, Error>
pub fn to_commitment(
&self,
program_id: &ProgramID<N>,
record_name: &Identifier<N>
) -> Result<Field<N>, Error>
Returns the record commitment.
impl<N> Record<N, Ciphertext<N>>where
N: Network,
impl<N> Record<N, Ciphertext<N>>where
N: Network,
pub fn to_commitment(
&self,
_program_id: &ProgramID<N>,
_record_name: &Identifier<N>
) -> Result<Field<N>, Error>
pub fn to_commitment(
&self,
_program_id: &ProgramID<N>,
_record_name: &Identifier<N>
) -> Result<Field<N>, Error>
Returns the record commitment.
impl<N, Private> Record<N, Private>where
N: Network,
Private: Visibility,
impl<N, Private> Record<N, Private>where
N: Network,
Private: Visibility,
pub fn from_plaintext(
owner: Owner<N, Plaintext<N>>,
gates: Balance<N, Plaintext<N>>,
data: IndexMap<Identifier<N>, Entry<N, Plaintext<N>>, RandomState>,
nonce: Group<N>
) -> Result<Record<N, Plaintext<N>>, Error>
pub fn from_plaintext(
owner: Owner<N, Plaintext<N>>,
gates: Balance<N, Plaintext<N>>,
data: IndexMap<Identifier<N>, Entry<N, Plaintext<N>>, RandomState>,
nonce: Group<N>
) -> Result<Record<N, Plaintext<N>>, Error>
Initializes a new record plaintext.
pub fn from_ciphertext(
owner: Owner<N, Ciphertext<N>>,
gates: Balance<N, Ciphertext<N>>,
data: IndexMap<Identifier<N>, Entry<N, Ciphertext<N>>, RandomState>,
nonce: Group<N>
) -> Result<Record<N, Ciphertext<N>>, Error>
pub fn from_ciphertext(
owner: Owner<N, Ciphertext<N>>,
gates: Balance<N, Ciphertext<N>>,
data: IndexMap<Identifier<N>, Entry<N, Ciphertext<N>>, RandomState>,
nonce: Group<N>
) -> Result<Record<N, Ciphertext<N>>, Error>
Initializes a new record ciphertext.
impl<N, Private> Record<N, Private>where
N: Network,
Private: Visibility,
impl<N, Private> Record<N, Private>where
N: Network,
Private: Visibility,
pub const fn data(
&self
) -> &IndexMap<Identifier<N>, Entry<N, Private>, RandomState>
pub const fn data(
&self
) -> &IndexMap<Identifier<N>, Entry<N, Private>, RandomState>
Returns the program data.
impl<N, Private> Record<N, Private>where
N: Network,
Private: Visibility,
impl<N, Private> Record<N, Private>where
N: Network,
Private: Visibility,
pub fn into_owner(self) -> Owner<N, Private>
pub fn into_owner(self) -> Owner<N, Private>
Returns the owner of the program record, and consumes self
.
pub fn into_gates(self) -> Balance<N, Private>
pub fn into_gates(self) -> Balance<N, Private>
Returns the gates of the program record, and consumes self
.
pub fn into_data(
self
) -> IndexMap<Identifier<N>, Entry<N, Private>, RandomState>
pub fn into_data(
self
) -> IndexMap<Identifier<N>, Entry<N, Private>, RandomState>
Returns the program data, and consumes self
.
pub fn into_nonce(self) -> Group<N>
pub fn into_nonce(self) -> Group<N>
Returns the nonce of the program record, and consumes self
.
Trait Implementations
impl<N> Debug for Record<N, Ciphertext<N>>where
N: Network,
impl<N> Debug for Record<N, Ciphertext<N>>where
N: Network,
impl<'de, N> Deserialize<'de> for Record<N, Ciphertext<N>>where
N: Network,
impl<'de, N> Deserialize<'de> for Record<N, Ciphertext<N>>where
N: Network,
fn deserialize<D>(
deserializer: D
) -> Result<Record<N, Ciphertext<N>>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<Record<N, Ciphertext<N>>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserializes the record ciphertext from a string or bytes.
impl<'de, N> Deserialize<'de> for Record<N, Plaintext<N>>where
N: Network,
impl<'de, N> Deserialize<'de> for Record<N, Plaintext<N>>where
N: Network,
fn deserialize<D>(
deserializer: D
) -> Result<Record<N, Plaintext<N>>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<Record<N, Plaintext<N>>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserializes the record plaintext from a string or bytes.
impl<N> Display for Record<N, Ciphertext<N>>where
N: Network,
impl<N> Display for Record<N, Ciphertext<N>>where
N: Network,
impl<N, Private> Equal<Record<N, Private>> for Record<N, Private>where
N: Network,
Private: Visibility<Boolean = Boolean<N>>,
impl<N, Private> Equal<Record<N, Private>> for Record<N, Private>where
N: Network,
Private: Visibility<Boolean = Boolean<N>>,
fn is_equal(
&self,
other: &Record<N, Private>
) -> <Record<N, Private> as Equal<Record<N, Private>>>::Output
fn is_equal(
&self,
other: &Record<N, Private>
) -> <Record<N, Private> as Equal<Record<N, Private>>>::Output
Returns true
if self
and other
are equal.
Note: This method does not check the nonce
equality.
fn is_not_equal(
&self,
other: &Record<N, Private>
) -> <Record<N, Private> as Equal<Record<N, Private>>>::Output
fn is_not_equal(
&self,
other: &Record<N, Private>
) -> <Record<N, Private> as Equal<Record<N, Private>>>::Output
Returns true
if self
and other
are not equal.
Note: This method does not check the nonce
equality.
type Output = Boolean<N>
impl<N, Private> FromBytes for Record<N, Private>where
N: Network,
Private: Visibility,
impl<N, Private> FromBytes for Record<N, Private>where
N: Network,
Private: Visibility,
impl<N> FromStr for Record<N, Ciphertext<N>>where
N: Network,
impl<N> FromStr for Record<N, Ciphertext<N>>where
N: Network,
impl<N> Parser for Record<N, Ciphertext<N>>where
N: Network,
impl<N> Parser for Record<N, Ciphertext<N>>where
N: Network,
impl<N, Private> PartialEq<Record<N, Private>> for Record<N, Private>where
N: Network,
Private: Visibility<Boolean = Boolean<N>>,
impl<N, Private> PartialEq<Record<N, Private>> for Record<N, Private>where
N: Network,
Private: Visibility<Boolean = Boolean<N>>,
impl<N> Serialize for Record<N, Ciphertext<N>>where
N: Network,
impl<N> Serialize for Record<N, Ciphertext<N>>where
N: Network,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serializes the record ciphertext into a string or as bytes.
impl<N> Serialize for Record<N, Plaintext<N>>where
N: Network,
impl<N> Serialize for Record<N, Plaintext<N>>where
N: Network,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serializes the record plaintext into a string or as bytes.
impl<N> ToBits for Record<N, Ciphertext<N>>where
N: Network,
impl<N> ToBits for Record<N, Ciphertext<N>>where
N: Network,
impl<N> ToBits for Record<N, Plaintext<N>>where
N: Network,
impl<N> ToBits for Record<N, Plaintext<N>>where
N: Network,
impl<N, Private> ToBytes for Record<N, Private>where
N: Network,
Private: Visibility,
impl<N, Private> ToBytes for Record<N, Private>where
N: Network,
Private: Visibility,
impl<N> ToFields for Record<N, Ciphertext<N>>where
N: Network,
impl<N> ToFields for Record<N, Ciphertext<N>>where
N: Network,
impl<N, Private> Eq for Record<N, Private>where
N: Network,
Private: Visibility<Boolean = Boolean<N>>,
Auto Trait Implementations
impl<N, Private> RefUnwindSafe for Record<N, Private>where
N: RefUnwindSafe,
Private: RefUnwindSafe,
<N as Environment>::Field: RefUnwindSafe,
<N as Environment>::Projective: RefUnwindSafe,
<N as Environment>::Scalar: RefUnwindSafe,
impl<N, Private> Send for Record<N, Private>where
Private: Send,
impl<N, Private> Sync for Record<N, Private>where
Private: Sync,
impl<N, Private> Unpin for Record<N, Private>where
N: Unpin,
Private: Unpin,
<N as Environment>::Field: Unpin,
<N as Environment>::Projective: Unpin,
<N as Environment>::Scalar: Unpin,
impl<N, Private> UnwindSafe for Record<N, Private>where
N: UnwindSafe,
Private: UnwindSafe,
<N as Environment>::Field: UnwindSafe,
<N as Environment>::Projective: UnwindSafe,
<N as Environment>::Scalar: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T>where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T>where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourcefn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T>where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T>where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T>where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T>where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
T: Future, type Output = <T as Future>::Output;
sourcefn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T>where
T: Future, type Output = <T as Future>::Output;
fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T>where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;