[][src]Enum forest_ipld::Ipld

pub enum Ipld {
    Null,
    Bool(bool),
    Integer(i128),
    Float(f64),
    String(String),
    Bytes(Vec<u8>),
    List(Vec<Ipld>),
    Map(BTreeMap<String, Ipld>),
    Link(Cid),
}

Represents IPLD data structure used when serializing and deserializing data.

Variants

Null

Represents a null value.

let v = ipld!(null);
Bool(bool)

Represents a boolean value.

let v = ipld!(true);
Integer(i128)

Represents a signed integer value.

let v = ipld!(28);
Float(f64)

Represents a floating point value.

let v = ipld!(8.5);
String(String)

Represents a String.

let v = ipld!("string");
Bytes(Vec<u8>)

Represents Bytes.

let v = ipld!(Bytes(vec![0x98, 0x8, 0x2a, 0xff]));
List(Vec<Ipld>)

Represents List of IPLD objects.

let v = ipld!([1, "string", null]);

Represents a map of strings to Ipld objects.

let v = ipld!({"key": "value", "bool": true});

Represents a link to another piece of data through a content identifier (Cid). Using ipld macro, can wrap Cid with Link to be explicit of Link type, or let it resolve.

let cid: Cid = "QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n".parse().unwrap();
let v1 = ipld!(Link(cid.clone()));
let v2 = ipld!(cid);
assert_eq!(v1, v2);

Trait Implementations

impl Cbor for Ipld[src]

impl Clone for Ipld[src]

impl Debug for Ipld[src]

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

impl PartialEq<Ipld> for Ipld[src]

impl Serialize for Ipld[src]

impl StructuralPartialEq for Ipld[src]

Auto Trait Implementations

impl RefUnwindSafe for Ipld

impl Send for Ipld

impl Sync for Ipld

impl Unpin for Ipld

impl UnwindSafe for Ipld

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> Same<T> for T

type Output = T

Should always be Self

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.