Struct bp7::bundle::Bundle [−][src]
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: PrimaryBlock
canonicals: 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.
pub fn extension_block_by_type(
&self,
block_type: CanonicalBlockType
) -> Option<&CanonicalBlock>
pub fn extension_block_by_type(
&self,
block_type: CanonicalBlockType
) -> Option<&CanonicalBlock>
Get first extension block matching the block type
pub fn extension_block_by_type_mut(
&mut self,
block_type: CanonicalBlockType
) -> Option<&mut CanonicalBlock>
pub fn extension_block_by_type_mut(
&mut self,
block_type: CanonicalBlockType
) -> Option<&mut CanonicalBlock>
Get mutable reference for first extension block matching the block type
Serialize bundle as CBOR encoded byte buffer.
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
Deserialize this value from the given Serde deserializer. Read more
Deserialize from JSON string.
Deserialize from CBOR byte buffer.
Auto Trait Implementations
impl RefUnwindSafe for Bundle
impl UnwindSafe for Bundle
Blanket Implementations
Mutably borrows from an owned value. Read more