Struct libp2p::pnet::PreSharedKey
source · [−]pub struct PreSharedKey(_);
Expand description
A pre-shared key, consisting of 32 bytes of random data.
Implementations
sourceimpl PreSharedKey
impl PreSharedKey
sourcepub fn fingerprint(&self) -> Fingerprint
pub fn fingerprint(&self) -> Fingerprint
Compute PreSharedKey fingerprint identical to the go-libp2p fingerprint. The computation of the fingerprint is not specified in the spec.
This provides a way to check that private keys are properly configured without dumping the key itself to the console.
Trait Implementations
sourceimpl Clone for PreSharedKey
impl Clone for PreSharedKey
sourcepub fn clone(&self) -> PreSharedKey
pub fn clone(&self) -> PreSharedKey
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for PreSharedKey
impl Debug for PreSharedKey
sourceimpl Display for PreSharedKey
impl Display for PreSharedKey
Dumps a PreSharedKey in key file format compatible with go-libp2p
sourceimpl FromStr for PreSharedKey
impl FromStr for PreSharedKey
Parses a PreSharedKey from a key file
currently supports only base16 encoding.
type Err = KeyParseError
type Err = KeyParseError
The associated error which can be returned from parsing.
sourcepub fn from_str(s: &str) -> Result<PreSharedKey, <PreSharedKey as FromStr>::Err>
pub fn from_str(s: &str) -> Result<PreSharedKey, <PreSharedKey as FromStr>::Err>
Parses a string s
to return a value of this type. Read more
sourcepub fn eq(&self, other: &PreSharedKey) -> bool
pub fn eq(&self, other: &PreSharedKey) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcepub fn ne(&self, other: &PreSharedKey) -> bool
pub fn ne(&self, other: &PreSharedKey) -> bool
This method tests for !=
.
impl Copy for PreSharedKey
impl Eq for PreSharedKey
impl StructuralEq for PreSharedKey
impl StructuralPartialEq for PreSharedKey
Auto Trait Implementations
impl RefUnwindSafe for PreSharedKey
impl Send for PreSharedKey
impl Sync for PreSharedKey
impl Unpin for PreSharedKey
impl UnwindSafe for PreSharedKey
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more