pub enum BinaryProtocol<F = Bytes> {
__Phantom(BinaryProtocol<F>),
BinaryProtocol,
}
Expand description
A straight-forward binary format that encodes numeric values in fixed width.
ⓘ
let protocol = BinaryProtocol;
let transport = HttpClient::new(ENDPOINT)?;
let client = <dyn BuckGraphService>::new(protocol, transport);
The type parameter is the Framing expected by the transport on which this
protocol is operating. Usually by convention the transport itself serves as
the Framing impl, so for example in the case of HttpClient above, the
compiler has inferred F = HttpClient
.
Where the compiler reports that a Framing can’t be inferred, one can be specified explicitly:
ⓘ
let protocol = BinaryProtocol::<SRHeaderTransport>;
Variants§
Trait Implementations§
Source§impl<F> Clone for BinaryProtocol<F>
impl<F> Clone for BinaryProtocol<F>
Source§impl<F> Protocol for BinaryProtocol<F>where
F: Framing + 'static,
impl<F> Protocol for BinaryProtocol<F>where
F: Framing + 'static,
const PROTOCOL_ID: ProtocolID = ProtocolID::BinaryProtocol
Source§type Sizer = BinaryProtocolSerializer<SizeCounter>
type Sizer = BinaryProtocolSerializer<SizeCounter>
Compute the size of a frame for a given protocol. This can be exact or too large, but
must not be too small.
Source§type Serializer = BinaryProtocolSerializer<<F as Framing>::EncBuf>
type Serializer = BinaryProtocolSerializer<<F as Framing>::EncBuf>
Serialize into a buffer. The buffer is allocated with the size computed by Sizer, so
it must be large enough.
Source§type Deserializer = BinaryProtocolDeserializer<<F as Framing>::DecBuf>
type Deserializer = BinaryProtocolDeserializer<<F as Framing>::DecBuf>
Set up a deserializer from a frame’s buffer.
fn serializer<SZ, SER>( size: SZ, ser: SER, ) -> <Self::Serializer as ProtocolWriter>::Final
fn deserializer(buf: F::DecBuf) -> Self::Deserializer
fn into_buffer(deser: Self::Deserializer) -> F::DecBuf
impl<F> Copy for BinaryProtocol<F>
Auto Trait Implementations§
impl<F> Freeze for BinaryProtocol<F>
impl<F> RefUnwindSafe for BinaryProtocol<F>where
F: RefUnwindSafe,
impl<F> Send for BinaryProtocol<F>where
F: Send,
impl<F> Sync for BinaryProtocol<F>where
F: Sync,
impl<F> Unpin for BinaryProtocol<F>
impl<F> UnwindSafe for BinaryProtocol<F>where
F: RefUnwindSafe,
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