[][src]Enum cloudevents::event::Data

pub enum Data {
    String(String),
    Binary(Vec<u8>),
    Json(Value),
}

Possible data values

Variants

String(String)
Binary(Vec<u8>)
Json(Value)

Methods

impl Data[src]

pub fn from_base64<I>(i: I) -> Result<Self, DecodeError> where
    I: AsRef<[u8]>, 
[src]

Create a Data from a [Into<Vec<u8>>].

Example

use cloudevents::event::Data;

let value = Data::from_base64(b"dmFsdWU=").unwrap();
assert_eq!(value, Data::Binary(base64::decode("dmFsdWU=").unwrap()));

[AsRef<[u8]>]: https://doc.rust-lang.org/std/convert/trait.AsRef.html Data: enum.Data.html

Trait Implementations

impl Clone for Data[src]

impl Debug for Data[src]

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

impl Into<Data> for Value[src]

impl Into<Data> for Vec<u8>[src]

impl Into<Data> for String[src]

impl PartialEq<Data> for Data[src]

impl Serialize for Data[src]

impl StructuralPartialEq for Data[src]

impl TryFrom<Data> for Value[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Data> for String[src]

type Error = FromUtf8Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for Data

impl Send for Data

impl Sync for Data

impl Unpin for Data

impl UnwindSafe for Data

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: 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, 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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,