Ipld

Enum Ipld 

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

Ipld

Variants§

§

Null

Represents the absence of a value or the value undefined.

§

Bool(bool)

Represents a boolean value.

§

Integer(i128)

Represents an integer.

§

Float(f64)

Represents a floating point value.

§

String(String)

Represents an UTF-8 string.

§

Bytes(Vec<u8>)

Represents a sequence of bytes.

§

List(Vec<Ipld>)

Represents a list.

§

Map(BTreeMap<String, Ipld>)

Represents a map of strings.

Represents a map of integers.

Implementations§

Source§

impl Ipld

Source

pub fn kind(&self) -> IpldKind

Convert from an Ipld object into its kind without any associated values.

This is intentionally not implemented via From<Ipld> to prevent accidental conversions by making it more explicit.

Source

pub fn take<'a, T: Into<IpldIndex<'a>>>( self, index: T, ) -> Result<Option<Self>, IndexError>

Destructs an ipld list or map

Source

pub fn get<'a, T: Into<IpldIndex<'a>>>( &self, index: T, ) -> Result<Option<&Self>, IndexError>

Indexes into an ipld list or map.

Source

pub fn iter(&self) -> IpldIter<'_>

Returns an iterator.

Source

pub fn references<E: Extend<Cid>>(&self, set: &mut E)

Returns the references to other blocks.

Trait Implementations§

Source§

impl Clone for Ipld

Source§

fn clone(&self) -> Ipld

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Ipld

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&[u8]> for Ipld

Source§

fn from(t: &[u8]) -> Self

Converts to this type from the input type.
Source§

impl From<&Cid<64>> for Ipld

Source§

fn from(t: &Cid) -> Self

Converts to this type from the input type.
Source§

impl From<&str> for Ipld

Source§

fn from(t: &str) -> Self

Converts to this type from the input type.
Source§

impl From<BTreeMap<String, Ipld>> for Ipld

Source§

fn from(t: BTreeMap<String, Ipld>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<[u8]>> for Ipld

Source§

fn from(t: Box<[u8]>) -> Self

Converts to this type from the input type.
Source§

impl From<Cid<64>> for Ipld

Source§

fn from(t: Cid) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Ipld

Source§

fn from(t: String) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Ipld>> for Ipld

Source§

fn from(t: Vec<Ipld>) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<u8>> for Ipld

Source§

fn from(t: Vec<u8>) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for Ipld

Source§

fn from(t: bool) -> Self

Converts to this type from the input type.
Source§

impl From<f32> for Ipld

Source§

fn from(t: f32) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Ipld

Source§

fn from(t: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i128> for Ipld

Source§

fn from(t: i128) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Ipld

Source§

fn from(t: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Ipld

Source§

fn from(t: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Ipld

Source§

fn from(t: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Ipld

Source§

fn from(t: i8) -> Self

Converts to this type from the input type.
Source§

impl From<isize> for Ipld

Source§

fn from(t: isize) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Ipld

Source§

fn from(t: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Ipld

Source§

fn from(t: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Ipld

Source§

fn from(t: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Ipld

Source§

fn from(t: u8) -> Self

Converts to this type from the input type.
Source§

impl From<usize> for Ipld

Source§

fn from(t: usize) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Ipld

NaN floats are forbidden in the IPLD Data Model, but we do not enforce it. So in case such a value is introduced accidentally, make sure that it still compares as equal. This allows us to implement Eq for Ipld.

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<Ipld> for ()

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for BTreeMap<String, Ipld>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Cid

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Option<BTreeMap<String, Ipld>>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Option<Cid>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Option<String>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Option<Vec<Ipld>>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Option<Vec<u8>>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Option<bool>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Option<f64>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Option<i128>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Option<i16>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Option<i32>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Option<i64>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Option<i8>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Option<isize>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Option<u128>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Option<u16>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Option<u32>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Option<u64>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Option<u8>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Option<usize>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for String

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Vec<Ipld>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Vec<u8>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for bool

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for f64

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for i128

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for i16

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for i32

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for i64

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for i8

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for isize

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for u128

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for u16

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for u32

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for u64

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for u8

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for usize

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Eq for Ipld

Auto Trait Implementations§

§

impl Freeze for Ipld

§

impl RefUnwindSafe for Ipld

§

impl Send for Ipld

§

impl Sync for Ipld

§

impl Unpin for Ipld

§

impl UnwindSafe for Ipld

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.