pub struct WordEncoder { /* private fields */ }
Expand description
Main encoder/decoder for three-word addresses
Implementations§
Source§impl WordEncoder
impl WordEncoder
Sourcepub fn with_dictionary(dictionary: WordDictionary) -> Self
pub fn with_dictionary(dictionary: WordDictionary) -> Self
Create encoder with custom dictionary
Sourcepub fn encode_multiaddr(
&self,
multiaddr: &Multiaddr,
) -> Result<ThreeWordAddress>
pub fn encode_multiaddr( &self, multiaddr: &Multiaddr, ) -> Result<ThreeWordAddress>
Convert multiaddr to three-word address
Sourcepub fn decode_to_multiaddr(&self, words: &ThreeWordAddress) -> Result<Multiaddr>
pub fn decode_to_multiaddr(&self, words: &ThreeWordAddress) -> Result<Multiaddr>
Convert three-word address back to multiaddr Note: This requires a registry/cache since the conversion isn’t perfectly reversible
Sourcepub fn validate_words(
&self,
first: &str,
second: &str,
third: &str,
) -> Result<()>
pub fn validate_words( &self, first: &str, second: &str, third: &str, ) -> Result<()>
Validate that all three words exist in the dictionary
Sourcepub fn dictionary(&self) -> &WordDictionary
pub fn dictionary(&self) -> &WordDictionary
Get the word dictionary
Trait Implementations§
Source§impl Clone for WordEncoder
impl Clone for WordEncoder
Source§fn clone(&self) -> WordEncoder
fn clone(&self) -> WordEncoder
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for WordEncoder
impl Debug for WordEncoder
Auto Trait Implementations§
impl Freeze for WordEncoder
impl RefUnwindSafe for WordEncoder
impl Send for WordEncoder
impl Sync for WordEncoder
impl Unpin for WordEncoder
impl UnwindSafe for WordEncoder
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