[−][src]Struct bp7::bundle::Bundle
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>
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]
src: EndpointID,
dst: EndpointID,
data: ByteBuffer
) -> Bundle
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]
&mut self,
block_type: CanonicalBlockType
) -> Option<&mut CanonicalBlock>
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 PartialEq<Bundle> for Bundle
[src]
impl From<Vec<u8>> for Bundle
[src]
Deserialize from CBOR byte buffer.
fn from(item: ByteBuffer) -> Self
[src]
impl From<String> for Bundle
[src]
Deserialize from JSON string.
impl Clone for Bundle
[src]
fn clone(&self) -> Bundle
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Default for Bundle
[src]
impl Debug for Bundle
[src]
impl Serialize for Bundle
[src]
impl<'de> Deserialize<'de> for Bundle
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,