pub struct Builder { /* private fields */ }Expand description
A buffer for accumulating a signed payload.
The buffer always begins with a domain field. Construct with
Builder::new.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn new(domain_suffix: &str) -> Self
pub fn new(domain_suffix: &str) -> Self
Start a new payload for the given domain suffix (e.g. "ref-update",
"object-bundle", "name"). The full domain string written is
"freenet-git/v1/<suffix>".
Sourcepub fn field_bytes(&mut self, bytes: &[u8]) -> &mut Self
pub fn field_bytes(&mut self, bytes: &[u8]) -> &mut Self
Append a field consisting of the given raw bytes.
Sourcepub fn field_u32(&mut self, x: u32) -> &mut Self
pub fn field_u32(&mut self, x: u32) -> &mut Self
Append a u32 field (4 bytes little-endian inside the length prefix).
Sourcepub fn field_u64(&mut self, x: u64) -> &mut Self
pub fn field_u64(&mut self, x: u64) -> &mut Self
Append a u64 field (8 bytes little-endian inside the length prefix).
Sourcepub fn field_bool(&mut self, b: bool) -> &mut Self
pub fn field_bool(&mut self, b: bool) -> &mut Self
Append a boolean field (1 byte).
Sourcepub fn field_option_bytes(&mut self, value: Option<&[u8]>) -> &mut Self
pub fn field_option_bytes(&mut self, value: Option<&[u8]>) -> &mut Self
Append an Option<&[u8]> field.
Encoded as [0x00] for None or [0x01, ...payload...] for Some,
where payload is the raw bytes (still inside the outer length prefix
of the field).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnsafeUnpin for Builder
impl UnwindSafe for Builder
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