Data

Struct Data 

Source
pub struct Data {
    pub name: Arc<Name>,
    /* private fields */
}
Expand description

An NDN Data packet.

Stores wire-format bytes for zero-copy CS storage and signature verification. The signed region is contiguous in the wire encoding — it is sliced directly from raw without copying.

Fields§

§name: Arc<Name>

Name — always decoded eagerly.

Implementations§

Source§

impl Data

Source

pub fn decode(raw: Bytes) -> Result<Data, PacketError>

Decode a Data packet from raw wire bytes.

Source

pub fn signed_region(&self) -> &[u8]

The signed region — a zero-copy slice suitable for signature verification.

Source

pub fn sig_value(&self) -> &[u8]

The signature value bytes — a zero-copy slice.

sig_value_start points to the SignatureValue TLV’s type byte (0x17). This method parses past the type and length to return only the raw value bytes.

Source

pub fn raw(&self) -> &Bytes

Source

pub fn implicit_digest(&self) -> Digest

The implicit SHA-256 digest of this Data packet — the SHA-256 hash of the full wire encoding. Used for exact Data retrieval via ImplicitSha256DigestComponent (type 0x01) in Interest names.

Source

pub fn content(&self) -> Option<&Bytes>

Source

pub fn meta_info(&self) -> Option<&MetaInfo>

Source

pub fn sig_info(&self) -> Option<&SignatureInfo>

Parse the delegation list from a Link object (ContentType=LINK).

Per NDN Packet Format v0.3 §6.3.1, when ContentType is LINK the Content field contains one or more Name TLVs. Returns None if this Data is not a Link or has no content.

Trait Implementations§

Source§

impl Debug for Data

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for Data

§

impl RefUnwindSafe for Data

§

impl Send for Data

§

impl Sync for Data

§

impl Unpin for Data

§

impl UnwindSafe for Data

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.

§

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

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Same for T

Source§

type Output = T

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