LinkedData

Enum LinkedData 

Source
pub enum LinkedData {
    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

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>(self, index: T) -> Result<Option<Ipld>, IndexError>
where T: Into<IpldIndex<'a>>,

Destructs an ipld list or map

Source

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

Indexes into an ipld list or map.

Source

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

Returns an iterator.

Source

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

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<(), Error>

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

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

Source§

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

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.

Source§

type Error = SerdeError

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

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

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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

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

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

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

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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

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

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

impl From<&[u8]> for Ipld

Source§

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

Converts to this type from the input type.
Source§

impl From<&Cid<64>> for Ipld

Source§

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

Converts to this type from the input type.
Source§

impl From<&str> for Ipld

Source§

fn from(t: &str) -> Ipld

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl From<Cid<64>> for Ipld

Source§

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

Converts to this type from the input type.
Source§

impl From<Link> for LinkedData

Source§

fn from(val: Link) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Ipld

Source§

fn from(t: String) -> Ipld

Converts to this type from the input type.
Source§

impl From<Vec<Ipld>> for Ipld

Source§

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

Converts to this type from the input type.
Source§

impl From<Vec<u8>> for Ipld

Source§

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

Converts to this type from the input type.
Source§

impl From<bool> for Ipld

Source§

fn from(t: bool) -> Ipld

Converts to this type from the input type.
Source§

impl From<f32> for Ipld

Source§

fn from(t: f32) -> Ipld

Converts to this type from the input type.
Source§

impl From<f64> for Ipld

Source§

fn from(t: f64) -> Ipld

Converts to this type from the input type.
Source§

impl From<i128> for Ipld

Source§

fn from(t: i128) -> Ipld

Converts to this type from the input type.
Source§

impl From<i16> for Ipld

Source§

fn from(t: i16) -> Ipld

Converts to this type from the input type.
Source§

impl From<i32> for Ipld

Source§

fn from(t: i32) -> Ipld

Converts to this type from the input type.
Source§

impl From<i64> for Ipld

Source§

fn from(t: i64) -> Ipld

Converts to this type from the input type.
Source§

impl From<i8> for Ipld

Source§

fn from(t: i8) -> Ipld

Converts to this type from the input type.
Source§

impl From<isize> for Ipld

Source§

fn from(t: isize) -> Ipld

Converts to this type from the input type.
Source§

impl From<u16> for Ipld

Source§

fn from(t: u16) -> Ipld

Converts to this type from the input type.
Source§

impl From<u32> for Ipld

Source§

fn from(t: u32) -> Ipld

Converts to this type from the input type.
Source§

impl From<u64> for Ipld

Source§

fn from(t: u64) -> Ipld

Converts to this type from the input type.
Source§

impl From<u8> for Ipld

Source§

fn from(t: u8) -> Ipld

Converts to this type from the input type.
Source§

impl From<usize> for Ipld

Source§

fn from(t: usize) -> Ipld

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: &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.
Source§

impl Serialize for Ipld

Source§

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
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<BTreeMap<String, Ipld>, <BTreeMap<String, Ipld> as TryFrom<Ipld>>::Error>

Performs the conversion.
Source§

impl TryFrom<Ipld> for Cid<64>

Source§

type Error = ConversionError

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

fn try_from(ipld: Ipld) -> Result<Cid<64>, <Cid<64> as TryFrom<Ipld>>::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<String, <String as TryFrom<Ipld>>::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<Vec<Ipld>, <Vec<Ipld> as TryFrom<Ipld>>::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<Vec<u8>, <Vec<u8> as TryFrom<Ipld>>::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> CompatExt for T

Source§

fn compat(self) -> Compat<T>

Applies the Compat adapter by value. Read more
Source§

fn compat_ref(&self) -> Compat<&T>

Applies the Compat adapter by shared reference. Read more
Source§

fn compat_mut(&mut self) -> Compat<&mut T>

Applies the Compat adapter by mutable reference. Read more
Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

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

Source§

fn vzip(self) -> V

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

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

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> RpcMessage for T
where T: Debug + Serialize + DeserializeOwned + Send + Sync + Unpin + 'static,