pub struct ExtensionBlock {
pub namespace: String,
pub type_name: String,
pub content: Vec<u8>,
}Expand description
EXTENSION block — user-defined block type.
Provides an escape hatch for custom content that doesn’t fit the 10 built-in block types. Extensions are namespaced to avoid collisions between different organizations or tools.
Field layout within body:
┌──────────┬───────────┬───────────┬───────────────────────────┐
│ Field ID │ Wire Type │ Name │ Description │
├──────────┼───────────┼───────────┼───────────────────────────┤
│ 1 │ Bytes │ namespace │ Namespace (e.g. "myorg") │
│ 2 │ Bytes │ type_name │ Type within namespace │
│ 3 │ Bytes │ content │ Opaque content bytes │
└──────────┴───────────┴───────────┴───────────────────────────┘The content field is opaque — the BCP decoder does not attempt to
parse it. Only consumers that understand the namespace/type_name
pair will interpret the content.
Fields§
§namespace: String§type_name: String§content: Vec<u8>Implementations§
Source§impl ExtensionBlock
impl ExtensionBlock
Sourcepub fn encode_body(&self) -> Vec<u8> ⓘ
pub fn encode_body(&self) -> Vec<u8> ⓘ
Serialize this block’s fields into a TLV-encoded body.
Sourcepub fn decode_body(buf: &[u8]) -> Result<Self, TypeError>
pub fn decode_body(buf: &[u8]) -> Result<Self, TypeError>
Deserialize an EXTENSION block from a TLV-encoded body.
Trait Implementations§
Source§impl Clone for ExtensionBlock
impl Clone for ExtensionBlock
Source§fn clone(&self) -> ExtensionBlock
fn clone(&self) -> ExtensionBlock
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExtensionBlock
impl Debug for ExtensionBlock
Source§impl PartialEq for ExtensionBlock
impl PartialEq for ExtensionBlock
impl Eq for ExtensionBlock
impl StructuralPartialEq for ExtensionBlock
Auto Trait Implementations§
impl Freeze for ExtensionBlock
impl RefUnwindSafe for ExtensionBlock
impl Send for ExtensionBlock
impl Sync for ExtensionBlock
impl Unpin for ExtensionBlock
impl UnsafeUnpin for ExtensionBlock
impl UnwindSafe for ExtensionBlock
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