[][src]Struct cosmwasm_std::Binary

pub struct Binary(pub Vec<u8>);

Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.

This is only needed as serde-json-{core,wasm} has a horrible encoding for Vec

Implementations

impl Binary[src]

pub fn from_base64(encoded: &str) -> StdResult<Self>[src]

take an (untrusted) string and decode it into bytes. fails if it is not valid base64

pub fn to_base64(&self) -> String[src]

encode to base64 string (guaranteed to be success as we control the data inside). this returns normalized form (with trailing = if needed)

pub fn as_slice(&self) -> &[u8][src]

pub fn len(&self) -> usize[src]

pub fn is_empty(&self) -> bool[src]

Trait Implementations

impl Clone for Binary[src]

impl Debug for Binary[src]

impl Default for Binary[src]

impl<'de> Deserialize<'de> for Binary[src]

Deserializes as a base64 string

impl Display for Binary[src]

impl<'_> From<&'_ [u8]> for Binary[src]

impl JsonSchema for Binary[src]

impl PartialEq<Binary> for Binary[src]

impl Serialize for Binary[src]

Serializes as a base64 string

impl StructuralPartialEq for Binary[src]

Auto Trait Implementations

impl RefUnwindSafe for Binary

impl Send for Binary

impl Sync for Binary

impl Unpin for Binary

impl UnwindSafe for Binary

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.