pub struct Builder<S, T: MutableData> { /* private fields */ }
Expand description
Builder provides a low-level wire protocol builder object. This is generic over buffer types and uses type-state mutation to ensure created objects are valid
Implementations§
Source§impl<S, T: MutableData> Builder<S, T>
impl<S, T: MutableData> Builder<S, T>
Sourcepub fn header_mut(&mut self) -> WireHeader<&mut [u8]>
pub fn header_mut(&mut self) -> WireHeader<&mut [u8]>
Fetch a mutable instance of the object header
Source§impl<T: MutableData> Builder<Init, T>
impl<T: MutableData> Builder<Init, T>
Sourcepub fn header(self, header: &Header) -> Self
pub fn header(self, header: &Header) -> Self
Set the object header. Note that length fields will be overwritten by actual lengths
Sourcepub fn body<B: ImmutableData>(
self,
body: &NewBody<B>,
secret_key: Option<&SecretKey>,
) -> Result<Builder<SetPrivateOptions, T>, Error>
pub fn body<B: ImmutableData>( self, body: &NewBody<B>, secret_key: Option<&SecretKey>, ) -> Result<Builder<SetPrivateOptions, T>, Error>
Add body data, mutating the state of the builder
Source§impl<T: MutableData> Builder<SetPrivateOptions, T>
impl<T: MutableData> Builder<SetPrivateOptions, T>
Sourcepub fn private_options<C: AsRef<[Options]>, E: ImmutableData>(
self,
options: &OptionsList<C, E>,
secret_key: Option<&SecretKey>,
) -> Result<Builder<SetPublicOptions, T>, Error>
pub fn private_options<C: AsRef<[Options]>, E: ImmutableData>( self, options: &OptionsList<C, E>, secret_key: Option<&SecretKey>, ) -> Result<Builder<SetPublicOptions, T>, Error>
Encode private options This must be done in one pass as the entire options block is encrypted
Source§impl<T: MutableData> Builder<SetPublicOptions, T>
impl<T: MutableData> Builder<SetPublicOptions, T>
Sourcepub fn public_options<C: AsRef<[Options]>, E: ImmutableData>(
self,
options: &OptionsList<C, E>,
) -> Result<Builder<SetPublicOptions, T>, Error>
pub fn public_options<C: AsRef<[Options]>, E: ImmutableData>( self, options: &OptionsList<C, E>, ) -> Result<Builder<SetPublicOptions, T>, Error>
Encode a list of public options
Sourcepub fn public_option(&mut self, option: &Options) -> Result<(), Error>
pub fn public_option(&mut self, option: &Options) -> Result<(), Error>
Add a single public option
pub fn sign(self, signing_key: &PrivateKey) -> Result<Container<T>, Error>
Auto Trait Implementations§
impl<S, T> Freeze for Builder<S, T>where
T: Freeze,
impl<S, T> RefUnwindSafe for Builder<S, T>where
T: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, T> Send for Builder<S, T>
impl<S, T> Sync for Builder<S, T>
impl<S, T> Unpin for Builder<S, T>
impl<S, T> UnwindSafe for Builder<S, T>where
T: UnwindSafe,
S: UnwindSafe,
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