Struct ipld_dagpb::PbNode

source ·
pub struct PbNode {
    pub links: Vec<PbLink>,
    pub data: Option<Bytes>,
}
Expand description

A protobuf ipld node.

Fields§

§links: Vec<PbLink>

List of protobuf ipld links.

§data: Option<Bytes>

Binary data blob.

Implementations§

source§

impl PbNode

source

pub fn from_bytes(buf: Bytes) -> Result<Self, Error>

Deserializes a PbNode from bytes.

source

pub fn into_bytes(self) -> Vec<u8>

Serializes a PbNode to bytes.

Trait Implementations§

source§

impl Clone for PbNode

source§

fn clone(&self) -> PbNode

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

impl Codec<PbNode> for DagPbCodec

source§

const CODE: u64 = 112u64

The multicodec code of the IPLD codec.
§

type Error = Error

The error that is returned if encoding or decoding fails.
source§

fn decode<R: BufRead>(reader: R) -> Result<PbNode, Self::Error>

Decode a reader into the desired type.
source§

fn encode<W: Write>(writer: W, data: &PbNode) -> Result<(), Self::Error>

Encode a type into a writer.
source§

fn decode_from_slice(bytes: &[u8]) -> Result<T, Self::Error>

Decode a slice into the desired type.
source§

fn encode_to_vec(data: &T) -> Result<Vec<u8>, Self::Error>

Encode a type into bytes.
source§

impl Debug for PbNode

source§

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

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

impl Default for PbNode

source§

fn default() -> PbNode

Returns the “default value” for a type. Read more
source§

impl From<PbNode> for Ipld

source§

fn from(node: PbNode) -> Self

Converts to this type from the input type.
source§

impl MessageWrite for PbNode

source§

fn get_size(&self) -> usize

Computes necessary binary size of self once serialized in protobuf
source§

fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()>

Writes Self into W writer
source§

fn write_file<P>(&self, p: P) -> Result<(), Error>
where P: AsRef<Path>,

Writes self into a file
source§

impl PartialEq for PbNode

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for PbNode

source§

impl StructuralPartialEq for PbNode

Auto Trait Implementations§

§

impl !Freeze for PbNode

§

impl RefUnwindSafe for PbNode

§

impl Send for PbNode

§

impl Sync for PbNode

§

impl Unpin for PbNode

§

impl UnwindSafe for PbNode

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

§

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

§

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

§

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.