[][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


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 From<Vec<u8>> for Binary[src]

impl Into<Vec<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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

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

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

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

The type returned in the event of a conversion error.