Enum hermes_ipfs::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<64>),
}
Expand description

IPLD 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§

§

impl Ipld

pub fn take<'a, T>(self, index: T) -> Result<Ipld, TypeError>
where T: Into<IpldIndex<'a>>,

Destructs an ipld list or map

pub fn get<'a, T>(&self, index: T) -> Result<&Ipld, TypeError>
where T: Into<IpldIndex<'a>>,

Indexes into an ipld list or map.

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

Returns an iterator.

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

Returns the references to other blocks.

Trait Implementations§

§

impl Clone for Ipld

§

fn clone(&self) -> Ipld

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
§

impl Debug for Ipld

§

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

Formats the value using the given formatter. Read more
§

impl Decode<DagCborCodec> for Ipld

§

fn decode<R>(_: DagCborCodec, r: &mut R) -> Result<Ipld, Error>
where R: Read + Seek,

Decode from an impl Read. Read more
§

impl Decode<DagJsonCodec> for Ipld

§

fn decode<R>(_: DagJsonCodec, r: &mut R) -> Result<Ipld, Error>
where R: Read + Seek,

Decode from an impl Read. Read more
§

impl Decode<DagPbCodec> for Ipld

§

fn decode<R>(_: DagPbCodec, r: &mut R) -> Result<Ipld, Error>
where R: Read + Seek,

Decode from an impl Read. Read more
§

impl Decode<IpldCodec> for Ipld

§

fn decode<R>(c: IpldCodec, r: &mut R) -> Result<Ipld, Error>
where R: Read + Seek,

Decode from an impl Read. Read more
§

impl Decode<RawCodec> for Ipld

§

fn decode<R>(c: RawCodec, r: &mut R) -> Result<Ipld, Error>
where R: Read + Seek,

Decode from an impl Read. Read more
§

impl<'de> Deserialize<'de> for Ipld

§

fn deserialize<D>( deserializer: D, ) -> Result<Ipld, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl<'de> Deserializer<'de> for Ipld

Deserialize from an Ipld enum into a Rust type.

The deserialization will return an error if you try to deserialize into an integer type that would be too small to hold the value stored in Ipld::Integer.

[Ipld::Floats] can be converted to f32 if there is no of precision, else it will error.

§

type Error = SerdeError

The error type that can be returned if some error occurs during deserialization.
§

fn deserialize_any<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Require the Deserializer to figure out how to drive the visitor based on what data type is in the input. Read more
§

fn deserialize_unit<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a unit value.
§

fn deserialize_bool<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a bool value.
§

fn deserialize_i8<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an i8 value.
§

fn deserialize_i16<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an i16 value.
§

fn deserialize_i32<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an i32 value.
§

fn deserialize_i64<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an i64 value.
§

fn deserialize_u8<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a u8 value.
§

fn deserialize_u16<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a u16 value.
§

fn deserialize_u32<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a u32 value.
§

fn deserialize_u64<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a u64 value.
§

fn deserialize_f32<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a f32 value.
§

fn deserialize_f64<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a f64 value.
§

fn deserialize_char<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a char value.
§

fn deserialize_str<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a string value and does not benefit from taking ownership of buffered data owned by the Deserializer. Read more
§

fn deserialize_string<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a string value and would benefit from taking ownership of buffered data owned by the Deserializer. Read more
§

fn deserialize_bytes<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a byte array and does not benefit from taking ownership of buffered data owned by the Deserializer. Read more
§

fn deserialize_byte_buf<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a byte array and would benefit from taking ownership of buffered data owned by the Deserializer. Read more
§

fn deserialize_seq<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a sequence of values.
§

fn deserialize_tuple<V>( self, len: usize, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a sequence of values and knows how many values there are without looking at the serialized data.
§

fn deserialize_tuple_struct<V>( self, _name: &str, len: usize, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a tuple struct with a particular name and number of fields.
§

fn deserialize_map<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a map of key-value pairs.
§

fn deserialize_identifier<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting the name of a struct field or the discriminant of an enum variant.
§

fn deserialize_struct<V>( self, _name: &str, _fields: &[&str], visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a struct with a particular name and fields.
§

fn deserialize_unit_struct<V>( self, _name: &str, _visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a unit struct with a particular name.
§

fn deserialize_newtype_struct<V>( self, name: &str, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a newtype struct with a particular name.
§

fn deserialize_enum<V>( self, _name: &str, _variants: &[&str], visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an enum value with a particular name and possible variants.
§

fn deserialize_ignored_any<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type needs to deserialize a value whose type doesn’t matter because it is ignored. Read more
§

fn deserialize_option<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, <Ipld as Deserializer<'de>>::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an optional value. Read more
§

fn is_human_readable(&self) -> bool

Determine whether Deserialize implementations should expect to deserialize their human-readable form. Read more
source§

fn deserialize_i128<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an i128 value. Read more
source§

fn deserialize_u128<V>( self, visitor: V, ) -> Result<<V as Visitor<'de>>::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an u128 value. Read more
§

impl Encode<DagCborCodec> for Ipld

§

fn encode<W>(&self, c: DagCborCodec, w: &mut W) -> Result<(), Error>
where W: Write,

Encodes into a impl Write. Read more
§

impl Encode<DagJsonCodec> for Ipld

§

fn encode<W>(&self, _: DagJsonCodec, w: &mut W) -> Result<(), Error>
where W: Write,

Encodes into a impl Write. Read more
§

impl Encode<DagPbCodec> for Ipld

§

fn encode<W>(&self, _: DagPbCodec, w: &mut W) -> Result<(), Error>
where W: Write,

Encodes into a impl Write. Read more
§

impl Encode<IpldCodec> for Ipld

§

fn encode<W>(&self, c: IpldCodec, w: &mut W) -> Result<(), Error>
where W: Write,

Encodes into a impl Write. Read more
§

impl Encode<RawCodec> for Ipld

§

fn encode<W>(&self, c: RawCodec, w: &mut W) -> Result<(), Error>
where W: Write,

Encodes into a impl Write. Read more
§

impl From<&[u8]> for Ipld

§

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

Converts to this type from the input type.
§

impl From<&Cid<64>> for Ipld

§

fn from(t: &Cid<64>) -> Ipld

Converts to this type from the input type.
§

impl From<&str> for Ipld

§

fn from(t: &str) -> Ipld

Converts to this type from the input type.
§

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

§

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

Converts to this type from the input type.
§

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

§

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

Converts to this type from the input type.
§

impl From<Cid<64>> for Ipld

§

fn from(t: Cid<64>) -> Ipld

Converts to this type from the input type.
§

impl From<PbLink> for Ipld

§

fn from(link: PbLink) -> Ipld

Converts to this type from the input type.
§

impl From<PbNode> for Ipld

§

fn from(node: PbNode) -> Ipld

Converts to this type from the input type.
§

impl From<String> for Ipld

§

fn from(t: String) -> Ipld

Converts to this type from the input type.
§

impl From<Vec<Ipld>> for Ipld

§

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

Converts to this type from the input type.
§

impl From<Vec<u8>> for Ipld

§

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

Converts to this type from the input type.
§

impl From<bool> for Ipld

§

fn from(t: bool) -> Ipld

Converts to this type from the input type.
§

impl From<f32> for Ipld

§

fn from(t: f32) -> Ipld

Converts to this type from the input type.
§

impl From<f64> for Ipld

§

fn from(t: f64) -> Ipld

Converts to this type from the input type.
§

impl From<i128> for Ipld

§

fn from(t: i128) -> Ipld

Converts to this type from the input type.
§

impl From<i16> for Ipld

§

fn from(t: i16) -> Ipld

Converts to this type from the input type.
§

impl From<i32> for Ipld

§

fn from(t: i32) -> Ipld

Converts to this type from the input type.
§

impl From<i64> for Ipld

§

fn from(t: i64) -> Ipld

Converts to this type from the input type.
§

impl From<i8> for Ipld

§

fn from(t: i8) -> Ipld

Converts to this type from the input type.
§

impl From<isize> for Ipld

§

fn from(t: isize) -> Ipld

Converts to this type from the input type.
§

impl From<u16> for Ipld

§

fn from(t: u16) -> Ipld

Converts to this type from the input type.
§

impl From<u32> for Ipld

§

fn from(t: u32) -> Ipld

Converts to this type from the input type.
§

impl From<u64> for Ipld

§

fn from(t: u64) -> Ipld

Converts to this type from the input type.
§

impl From<u8> for Ipld

§

fn from(t: u8) -> Ipld

Converts to this type from the input type.
§

impl From<usize> for Ipld

§

fn from(t: usize) -> Ipld

Converts to this type from the input type.
§

impl PartialEq for Ipld

§

fn eq(&self, other: &Ipld) -> 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.
§

impl References<DagCborCodec> for Ipld

§

fn references<R, E>( _: DagCborCodec, r: &mut R, set: &mut E, ) -> Result<(), Error>
where R: Read + Seek, E: Extend<Cid<64>>,

Scrape the references from an impl Read. Read more
§

impl References<DagJsonCodec> for Ipld

§

fn references<R, E>( c: DagJsonCodec, r: &mut R, set: &mut E, ) -> Result<(), Error>
where R: Read + Seek, E: Extend<Cid<64>>,

Scrape the references from an impl Read. Read more
§

impl References<DagPbCodec> for Ipld

§

fn references<R, E>(_: DagPbCodec, r: &mut R, set: &mut E) -> Result<(), Error>
where R: Read + Seek, E: Extend<Cid<64>>,

Scrape the references from an impl Read. Read more
§

impl References<IpldCodec> for Ipld

§

fn references<R, E>(c: IpldCodec, r: &mut R, set: &mut E) -> Result<(), Error>
where R: Read + Seek, E: Extend<Cid<64>>,

Scrape the references from an impl Read. Read more
§

impl Serialize for Ipld

§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl TryFrom<ResolvedNode> for Ipld

§

type Error = ResolveError

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

fn try_from( r: ResolvedNode, ) -> Result<Ipld, <Ipld as TryFrom<ResolvedNode>>::Error>

Performs the conversion.
§

impl StructuralPartialEq 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
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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, dst: *mut T)

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

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> References<RawCodec> for T

§

fn references<R, E>(_c: RawCodec, _r: &mut R, _set: &mut E) -> Result<(), Error>
where R: Read, E: Extend<Cid<64>>,

Scrape the references from an impl Read. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
§

impl<T> TimeoutExt for T

§

fn timeout(self, duration: Duration) -> Timeout<Self>

Requires a Future or [Stream] to complete before the specific duration has elapsed. Read more
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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> DagCbor for T
where T: Encode<DagCborCodec> + Decode<DagCborCodec>,

source§

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