pub struct DXBBlock {
pub routing_header: RoutingHeader,
pub block_header: BlockHeader,
pub signature: Option<Vec<u8>>,
pub encrypted_header: EncryptedHeader,
pub body: Vec<u8>,
pub raw_bytes: Option<Vec<u8>>,
}Fields§
§routing_header: RoutingHeader§block_header: BlockHeader§signature: Option<Vec<u8>>§encrypted_header: EncryptedHeader§body: Vec<u8>§raw_bytes: Option<Vec<u8>>Implementations§
Source§impl DXBBlock
impl DXBBlock
pub fn new_with_body(body: &[u8]) -> DXBBlock
pub fn new( routing_header: RoutingHeader, block_header: BlockHeader, encrypted_header: EncryptedHeader, body: Vec<u8>, ) -> DXBBlock
pub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn recalculate_struct(&mut self) -> &mut Self
pub fn has_dxb_magic_number(dxb: &[u8]) -> bool
pub fn extract_dxb_block_length(dxb: &[u8]) -> Result<u16, HeaderParsingError>
pub fn from_bytes(bytes: &[u8]) -> Result<DXBBlock, DXBBlockParseError>
Sourcepub fn validate_signature(
self,
) -> MaybeAsync<Result<DXBBlock, SignatureValidationError>, impl Future<Output = Result<DXBBlock, SignatureValidationError>>>
pub fn validate_signature( self, ) -> MaybeAsync<Result<DXBBlock, SignatureValidationError>, impl Future<Output = Result<DXBBlock, SignatureValidationError>>>
Validates the signature of the block based on the signature type specified in the routing header. Returns Ok(self) if the signature is valid, or a SignatureValidationError if the signature is missing, cannot be parsed, or is invalid.
Sourcepub fn receiver_endpoints(&self) -> Vec<Endpoint>
pub fn receiver_endpoints(&self) -> Vec<Endpoint>
Get a list of all receiver endpoints from the routing header.
pub fn receivers(&self) -> Receivers
Sourcepub fn set_receivers<T>(&mut self, endpoints: T)
pub fn set_receivers<T>(&mut self, endpoints: T)
Update the receivers list in the routing header.
pub fn set_bounce_back(&mut self, bounce_back: bool)
pub fn is_bounce_back(&self) -> bool
pub fn sender(&self) -> &Endpoint
pub fn block_type(&self) -> BlockType
pub fn get_endpoint_context_id(&self) -> IncomingEndpointContextId
pub fn get_block_id(&self) -> BlockId
Sourcepub fn has_exact_receiver_count(&self) -> bool
pub fn has_exact_receiver_count(&self) -> bool
Returns true if the block has a fixed number of receivers without wildcard instances, and no @@any receiver.
pub fn clone_with_new_receivers<T>(&self, new_receivers: T) -> DXBBlock
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DXBBlock
impl<'de> Deserialize<'de> for DXBBlock
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for DXBBlock
impl RefUnwindSafe for DXBBlock
impl Send for DXBBlock
impl Sync for DXBBlock
impl Unpin for DXBBlock
impl UnsafeUnpin for DXBBlock
impl UnwindSafe for DXBBlock
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CustomError for T
impl<T> CustomError for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more