[][src]Struct bp7::bundle::Bundle

pub struct Bundle {
    pub primary: PrimaryBlock,
    pub canonicals: Vec<CanonicalBlock>,
}

Bundle represents a bundle as defined in section 4.2.1. Each Bundle contains one primary block and multiple canonical blocks.

Fields

primary: PrimaryBlockcanonicals: Vec<CanonicalBlock>

Methods

impl Bundle[src]

pub fn new(primary: PrimaryBlock, canonicals: Vec<CanonicalBlock>) -> Bundle[src]

pub fn new_standard_bundle(
    src: EndpointID,
    dst: EndpointID,
    data: ByteBuffer
) -> Bundle
[src]

Creates a new bundle with the given endpoints, a bundle age block and a payload block. CRC is set to CRC_32 by default and the lifetime is set to 60 * 60 seconds.

pub fn validation_errors(&self) -> Option<Bp7ErrorList>[src]

Validate bundle and optionally return list of errors.

pub fn is_administrative_record(&self) -> bool[src]

pub fn set_crc(&mut self, crc_type: CRCType)[src]

Sets the given CRCType for each block. The crc value is calculated on-the-fly before serializing.

pub fn crc_valid(&self) -> bool[src]

Check whether a bundle has only valid CRC checksums in all blocks.

pub fn calculate_crc(&mut self)[src]

Calculate crc for all blocks.

pub fn extension_block(
    &mut self,
    block_type: CanonicalBlockType
) -> Option<&mut CanonicalBlock>
[src]

pub fn to_cbor(&mut self) -> ByteBuffer[src]

Serialize bundle as CBOR encoded byte buffer.

pub fn to_json(&mut self) -> String[src]

Serialize bundle as JSON encoded string.

pub fn id(&self) -> String[src]

ID returns a kind of uniquene representation of this bundle, containing the souce node and creation timestamp. If this bundle is a fragment, the offset is also present.

Trait Implementations

impl Clone for Bundle[src]

default fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl PartialEq<Bundle> for Bundle[src]

impl Default for Bundle[src]

impl From<Vec<u8>> for Bundle[src]

Deserialize from CBOR byte buffer.

impl From<String> for Bundle[src]

Deserialize from JSON string.

impl Debug for Bundle[src]

impl Serialize for Bundle[src]

impl<'de> Deserialize<'de> for Bundle[src]

Auto Trait Implementations

impl Send for Bundle

impl Sync for Bundle

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

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