pub struct SimpleBiMapper<S: SphinxSuite, H: SphinxHeaderSpec>(pub(crate) BiHashMap<H::KeyId, <S::P as Keypair>::Public>);Expand description
Basic implementation of the [KeyIdMapping] trait for a simple bi-map.
Useful for testing or simple protocol implementations.
Tuple Fields§
§0: BiHashMap<H::KeyId, <S::P as Keypair>::Public>Trait Implementations§
Source§impl<S: SphinxSuite, H: SphinxHeaderSpec> From<BiHashMap<<H as SphinxHeaderSpec>::KeyId, <<S as SphinxSuite>::P as Keypair>::Public>> for SimpleBiMapper<S, H>
impl<S: SphinxSuite, H: SphinxHeaderSpec> From<BiHashMap<<H as SphinxHeaderSpec>::KeyId, <<S as SphinxSuite>::P as Keypair>::Public>> for SimpleBiMapper<S, H>
Source§impl<S, H> KeyIdMapping<<H as SphinxHeaderSpec>::KeyId, <<S as SphinxSuite>::P as Keypair>::Public> for SimpleBiMapper<S, H>where
S: SphinxSuite,
H: SphinxHeaderSpec,
<S::P as Keypair>::Public: Eq + Hash,
H::KeyId: Eq + Hash,
impl<S, H> KeyIdMapping<<H as SphinxHeaderSpec>::KeyId, <<S as SphinxSuite>::P as Keypair>::Public> for SimpleBiMapper<S, H>where
S: SphinxSuite,
H: SphinxHeaderSpec,
<S::P as Keypair>::Public: Eq + Hash,
H::KeyId: Eq + Hash,
Source§fn map_key_to_id(&self, key: &<S::P as Keypair>::Public) -> Option<H::KeyId>
fn map_key_to_id(&self, key: &<S::P as Keypair>::Public) -> Option<H::KeyId>
Maps public key to its unique identifier.
Source§fn map_id_to_public(&self, id: &H::KeyId) -> Option<<S::P as Keypair>::Public>
fn map_id_to_public(&self, id: &H::KeyId) -> Option<<S::P as Keypair>::Public>
Maps public key identifier to the actual public key.
§fn map_keys_to_ids(&self, keys: &[K]) -> Vec<Option<Id>>
fn map_keys_to_ids(&self, keys: &[K]) -> Vec<Option<Id>>
Convenience method to map a slice of public keys to IDs.
§fn map_ids_to_keys(&self, ids: &[Id]) -> Vec<Option<K>>
fn map_ids_to_keys(&self, ids: &[Id]) -> Vec<Option<K>>
Convenience method to map a slice of IDs to public keys.
Auto Trait Implementations§
impl<S, H> Freeze for SimpleBiMapper<S, H>
impl<S, H> RefUnwindSafe for SimpleBiMapper<S, H>where
<H as SphinxHeaderSpec>::KeyId: RefUnwindSafe,
<<S as SphinxSuite>::P as Keypair>::Public: RefUnwindSafe,
impl<S, H> Send for SimpleBiMapper<S, H>
impl<S, H> Sync for SimpleBiMapper<S, H>
impl<S, H> Unpin for SimpleBiMapper<S, H>
impl<S, H> UnwindSafe for SimpleBiMapper<S, H>where
<H as SphinxHeaderSpec>::KeyId: RefUnwindSafe,
<<S as SphinxSuite>::P as Keypair>::Public: 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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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