Struct identity_iota::core::BaseEncoding
source · [−]pub struct BaseEncoding;
Expand description
Provides utility functions for encoding and decoding between various bases.
Implementations
sourceimpl BaseEncoding
impl BaseEncoding
sourcepub fn encode<T>(data: &T, base: Base) -> String where
T: AsRef<[u8]> + ?Sized,
pub fn encode<T>(data: &T, base: Base) -> String where
T: AsRef<[u8]> + ?Sized,
Encodes the given data
to the specified base
.
sourcepub fn decode<T>(data: &T, base: Base) -> Result<Vec<u8, Global>, Error> where
T: AsRef<str> + ?Sized,
pub fn decode<T>(data: &T, base: Base) -> Result<Vec<u8, Global>, Error> where
T: AsRef<str> + ?Sized,
Decodes the given data
encoded as the specified base
.
sourcepub fn encode_base58<T>(data: &T) -> String where
T: AsRef<[u8]> + ?Sized,
pub fn encode_base58<T>(data: &T) -> String where
T: AsRef<[u8]> + ?Sized,
Encodes the given data
to Base::Base58Btc
.
Equivalent to encode(data, Base58Btc)
.
sourcepub fn decode_base58<T>(data: &T) -> Result<Vec<u8, Global>, Error> where
T: AsRef<str> + ?Sized,
pub fn decode_base58<T>(data: &T) -> Result<Vec<u8, Global>, Error> where
T: AsRef<str> + ?Sized,
Decodes the given data
encoded as Base::Base58Btc
.
Equivalent to decode(data, Base58Btc)
.
sourcepub fn encode_multibase<T>(data: &T, base: Option<Base>) -> String where
T: AsRef<[u8]> + ?Sized,
pub fn encode_multibase<T>(data: &T, base: Option<Base>) -> String where
T: AsRef<[u8]> + ?Sized,
Encodes the given data
as Multibase with the given base
, defaults to
Base::Base58Btc
if omitted.
NOTE: encode_multibase
is different from encode
because the
Multibase format prepends a character representing the base-encoding to the output.
Auto Trait Implementations
impl RefUnwindSafe for BaseEncoding
impl Send for BaseEncoding
impl Sync for BaseEncoding
impl Unpin for BaseEncoding
impl UnwindSafe for BaseEncoding
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more