pub struct Record<N, Private>where
N: Network,
Private: Visibility,{ /* private fields */ }Expand description
A value stored in program record.
Implementations§
Source§impl<N> Record<N, Ciphertext<N>>where
N: Network,
impl<N> Record<N, Ciphertext<N>>where
N: Network,
Sourcepub fn decrypt(
&self,
view_key: &ViewKey<N>,
) -> Result<Record<N, Plaintext<N>>, Error>
pub fn decrypt( &self, view_key: &ViewKey<N>, ) -> Result<Record<N, Plaintext<N>>, Error>
Decrypts self into plaintext using the given view key and checks that the owner matches the view key.
Sourcepub fn decrypt_symmetric_unchecked(
&self,
record_view_key: &Field<N>,
) -> Result<Record<N, Plaintext<N>>, Error>
pub fn decrypt_symmetric_unchecked( &self, record_view_key: &Field<N>, ) -> Result<Record<N, Plaintext<N>>, Error>
Decrypts self into plaintext using the given record view key.
Note: This method does not check that the record view key corresponds to the record owner.
Use Self::decrypt for the checked variant.
Source§impl<N> Record<N, Plaintext<N>>where
N: Network,
impl<N> Record<N, Plaintext<N>>where
N: Network,
Sourcepub 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.
Sourcepub fn encrypt_symmetric_unchecked(
&self,
record_view_key: &Field<N>,
) -> Result<Record<N, Ciphertext<N>>, Error>
pub fn encrypt_symmetric_unchecked( &self, record_view_key: &Field<N>, ) -> Result<Record<N, Ciphertext<N>>, Error>
Encrypts self under the given record view key.
Note: This method does not check that the record view key corresponds to the record owner.
Use Self::encrypt for the checked variant.
Source§impl<N> Record<N, Ciphertext<N>>where
N: Network,
impl<N> Record<N, Ciphertext<N>>where
N: Network,
Sourcepub fn is_owner(&self, view_key: &ViewKey<N>) -> bool
pub fn is_owner(&self, view_key: &ViewKey<N>) -> bool
Decrypts self into plaintext using the given view key.
Sourcepub fn is_owner_with_address_x_coordinate(
&self,
view_key: &ViewKey<N>,
address_x_coordinate: &Field<N>,
) -> bool
pub fn is_owner_with_address_x_coordinate( &self, view_key: &ViewKey<N>, address_x_coordinate: &Field<N>, ) -> bool
Decrypts self into plaintext using the x-coordinate of the address corresponding to the given view key.
Source§impl<N, Private> Record<N, Private>where
N: Network,
Private: Visibility,
impl<N, Private> Record<N, Private>where
N: Network,
Private: Visibility,
Sourcepub 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.
Source§impl<N, Private> Record<N, Private>where
N: Network,
Private: Visibility,
impl<N, Private> Record<N, Private>where
N: Network,
Private: Visibility,
Source§impl<N> Record<N, Plaintext<N>>where
N: Network,
impl<N> Record<N, Plaintext<N>>where
N: Network,
Sourcepub 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.
Source§impl<N> Record<N, Ciphertext<N>>where
N: Network,
impl<N> Record<N, Ciphertext<N>>where
N: Network,
Sourcepub 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.
Source§impl<N, Private> Record<N, Private>where
N: Network,
Private: Visibility,
impl<N, Private> Record<N, Private>where
N: Network,
Private: Visibility,
Sourcepub fn from_plaintext(
owner: Owner<N, Plaintext<N>>,
data: IndexMap<Identifier<N>, Entry<N, Plaintext<N>>>,
nonce: Group<N>,
) -> Result<Record<N, Plaintext<N>>, Error>
pub fn from_plaintext( owner: Owner<N, Plaintext<N>>, data: IndexMap<Identifier<N>, Entry<N, Plaintext<N>>>, nonce: Group<N>, ) -> Result<Record<N, Plaintext<N>>, Error>
Initializes a new record plaintext.
Sourcepub fn from_ciphertext(
owner: Owner<N, Ciphertext<N>>,
data: IndexMap<Identifier<N>, Entry<N, Ciphertext<N>>>,
nonce: Group<N>,
) -> Result<Record<N, Ciphertext<N>>, Error>
pub fn from_ciphertext( owner: Owner<N, Ciphertext<N>>, data: IndexMap<Identifier<N>, Entry<N, Ciphertext<N>>>, nonce: Group<N>, ) -> Result<Record<N, Ciphertext<N>>, Error>
Initializes a new record ciphertext.
Source§impl<N, Private> Record<N, Private>where
N: Network,
Private: Visibility,
impl<N, Private> Record<N, Private>where
N: Network,
Private: Visibility,
Source§impl<N, Private> Record<N, Private>where
N: Network,
Private: Visibility,
impl<N, Private> Record<N, Private>where
N: Network,
Private: Visibility,
Sourcepub 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.
Sourcepub fn into_data(self) -> IndexMap<Identifier<N>, Entry<N, Private>>
pub fn into_data(self) -> IndexMap<Identifier<N>, Entry<N, Private>>
Returns the program data, and consumes self.
Sourcepub 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§
Source§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,
Source§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.
Source§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,
Source§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.
Source§impl<N, Private> Equal for Record<N, Private>
impl<N, Private> Equal for Record<N, Private>
Source§fn is_equal(
&self,
other: &Record<N, Private>,
) -> <Record<N, Private> as Equal>::Output
fn is_equal( &self, other: &Record<N, Private>, ) -> <Record<N, Private> as Equal>::Output
Returns true if self and other are equal.
Source§fn is_not_equal(
&self,
other: &Record<N, Private>,
) -> <Record<N, Private> as Equal>::Output
fn is_not_equal( &self, other: &Record<N, Private>, ) -> <Record<N, Private> as Equal>::Output
Returns true if self and other are not equal.
type Output = Boolean<N>
Source§impl<N> Serialize for Record<N, Ciphertext<N>>where
N: Network,
impl<N> Serialize for Record<N, Ciphertext<N>>where
N: Network,
Source§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.
Source§impl<N> Serialize for Record<N, Plaintext<N>>where
N: Network,
impl<N> Serialize for Record<N, Plaintext<N>>where
N: Network,
Source§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.
Source§impl<N> ToBits for Record<N, Ciphertext<N>>where
N: Network,
impl<N> ToBits for Record<N, Ciphertext<N>>where
N: Network,
Source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
Returns this data as a list of little-endian bits.
Source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
Returns this data as a list of big-endian bits.
Source§fn to_bits_le(&self) -> Vec<bool>
fn to_bits_le(&self) -> Vec<bool>
self as a boolean array in little-endian order.Source§fn to_bits_be(&self) -> Vec<bool>
fn to_bits_be(&self) -> Vec<bool>
self as a boolean array in big-endian order.Source§impl<N> ToBits for Record<N, Plaintext<N>>where
N: Network,
impl<N> ToBits for Record<N, Plaintext<N>>where
N: Network,
Source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
Returns this data as a list of little-endian bits.
Source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
Returns this data as a list of big-endian bits.
Source§fn to_bits_le(&self) -> Vec<bool>
fn to_bits_le(&self) -> Vec<bool>
self as a boolean array in little-endian order.Source§fn to_bits_be(&self) -> Vec<bool>
fn to_bits_be(&self) -> Vec<bool>
self as a boolean array in big-endian order.impl<N, Private> Eq for Record<N, Private>
Auto Trait Implementations§
impl<N, Private> Freeze for Record<N, Private>
impl<N, Private> RefUnwindSafe for Record<N, Private>where
Private: RefUnwindSafe,
<N as Environment>::Projective: RefUnwindSafe,
<N as Environment>::Field: RefUnwindSafe,
<N as Environment>::Scalar: RefUnwindSafe,
N: 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
Private: Unpin,
<N as Environment>::Projective: Unpin,
<N as Environment>::Field: Unpin,
<N as Environment>::Scalar: Unpin,
N: Unpin,
impl<N, Private> UnwindSafe for Record<N, Private>where
Private: UnwindSafe,
<N as Environment>::Projective: UnwindSafe,
<N as Environment>::Field: UnwindSafe,
<N as Environment>::Scalar: UnwindSafe,
N: 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,
Source§impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
fn take_from_value<D>(
value: &mut Value,
field: &str,
) -> Result<T, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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