pub enum Authority<N: Network> {
Beacon(Signature<N>),
Quorum(Subdag<N>),
}
Variants§
Implementations§
source§impl<N: Network> Authority<N>
impl<N: Network> Authority<N>
sourcepub fn new_beacon<R: Rng + CryptoRng>(
private_key: &PrivateKey<N>,
block_hash: Field<N>,
rng: &mut R
) -> Result<Self>
pub fn new_beacon<R: Rng + CryptoRng>( private_key: &PrivateKey<N>, block_hash: Field<N>, rng: &mut R ) -> Result<Self>
Initializes a new beacon authority.
sourcepub fn new_quorum(subdag: Subdag<N>) -> Self
pub fn new_quorum(subdag: Subdag<N>) -> Self
Initializes a new quorum authority.
source§impl<N: Network> Authority<N>
impl<N: Network> Authority<N>
sourcepub const fn from_beacon(signature: Signature<N>) -> Self
pub const fn from_beacon(signature: Signature<N>) -> Self
Initializes a new beacon authority from the given signature.
sourcepub const fn from_quorum(subdag: Subdag<N>) -> Self
pub const fn from_quorum(subdag: Subdag<N>) -> Self
Initializes a new quorum authority.
source§impl<N: Network> Authority<N>
impl<N: Network> Authority<N>
sourcepub fn to_address(&self) -> Address<N>
pub fn to_address(&self) -> Address<N>
Returns address of the authority. If the authority is a beacon, the address of the signer is returned. If the authority is a quorum, the address of the leader is returned.
Trait Implementations§
source§impl<'de, N: Network> Deserialize<'de> for Authority<N>
impl<'de, N: Network> Deserialize<'de> for Authority<N>
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserializes the authority from a string or bytes.
source§impl<N: PartialEq + Network> PartialEq for Authority<N>
impl<N: PartialEq + Network> PartialEq for Authority<N>
impl<N: Eq + Network> Eq for Authority<N>
impl<N: Network> StructuralEq for Authority<N>
impl<N: Network> StructuralPartialEq for Authority<N>
Auto Trait Implementations§
impl<N> RefUnwindSafe for Authority<N>where <N as Environment>::Field: RefUnwindSafe, <<N as Environment>::PairingCurve as PairingEngine>::G1Affine: RefUnwindSafe, <N as Environment>::Projective: RefUnwindSafe, <N as Environment>::Scalar: RefUnwindSafe, <N as Network>::TransactionID: RefUnwindSafe,
impl<N> Send for Authority<N>
impl<N> Sync for Authority<N>
impl<N> Unpin for Authority<N>where <N as Environment>::Projective: Unpin, <N as Environment>::Scalar: Unpin,
impl<N> UnwindSafe for Authority<N>where <N as Environment>::Field: RefUnwindSafe, <<N as Environment>::PairingCurve as PairingEngine>::G1Affine: RefUnwindSafe, <N as Environment>::Projective: UnwindSafe + RefUnwindSafe, <N as Environment>::Scalar: UnwindSafe + RefUnwindSafe, <N as Network>::TransactionID: RefUnwindSafe,
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
§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>,
§impl<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,
§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 Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.