pub trait ProtocolExtensionBuilder {
// Required methods
fn get_id(&self) -> u8;
fn build_from_bytes(
&self,
bytes: Bytes,
role: Role,
) -> Result<AnyProtocolExtension, WispError>;
fn build_to_extension(&self, role: Role) -> AnyProtocolExtension;
}
Expand description
Trait to build a Wisp protocol extension from a payload.
Required Methods§
Sourcefn get_id(&self) -> u8
fn get_id(&self) -> u8
Get the protocol extension ID.
Used to decide whether this builder should be used.
Sourcefn build_from_bytes(
&self,
bytes: Bytes,
role: Role,
) -> Result<AnyProtocolExtension, WispError>
fn build_from_bytes( &self, bytes: Bytes, role: Role, ) -> Result<AnyProtocolExtension, WispError>
Build a protocol extension from the extension’s metadata.
Sourcefn build_to_extension(&self, role: Role) -> AnyProtocolExtension
fn build_to_extension(&self, role: Role) -> AnyProtocolExtension
Build a protocol extension to send to the other side.