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

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>

Implementations

Validate bundle and optionally return list of errors.

Sort canonical blocks by block number

Automatically assign a block number and add canonical block to bundle

Checks whether the bundle is an administrative record

Return payload of bundle if an payload block exists and carries data.

Sets or updates the payload block

Sets or updates the payload

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

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

Calculate crc for all blocks.

Get first extension block matching the block type

Get mutable reference for first extension block matching the block type

Serialize bundle as CBOR encoded byte buffer.

Serialize bundle as JSON encoded string.

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.

Update extension blocks such as hop count, bundle age and previous node. Return true if all successful, omit missing blocks. Return false if hop count is exceeded, bundle age exceeds life time or bundle lifetime itself is exceeded

Return the previous node of a bundle should a Previous Node Block exist

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Deserialize from JSON string.

The type returned in the event of a conversion error.

Performs the conversion.

Deserialize from CBOR byte buffer.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.