Struct fbthrift_git::compact_protocol::CompactProtocol
source · pub struct CompactProtocol<F = Bytes>;Expand description
An efficient, dense encoding that uses variable-length integers and squeezes data into unused bits wherever possible.
ⓘ
let protocol = CompactProtocol;
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 = CompactProtocol::<SRHeaderTransport>;Trait Implementations§
source§impl<F> Clone for CompactProtocol<F>
impl<F> Clone for CompactProtocol<F>
source§impl<F> Protocol for CompactProtocol<F>where
F: Framing + 'static,
impl<F> Protocol for CompactProtocol<F>where
F: Framing + 'static,
§type Sizer = CompactProtocolSerializer<SizeCounter>
type Sizer = CompactProtocolSerializer<SizeCounter>
Compute the size of a frame for a given protocol. This can be exact or too large, but
must not be too small.
§type Serializer = CompactProtocolSerializer<<F as Framing>::EncBuf>
type Serializer = CompactProtocolSerializer<<F as Framing>::EncBuf>
Serialize into a buffer. The buffer is allocated with the size computed by Sizer, so
it must be large enough.
§type Deserializer = CompactProtocolDeserializer<<F as Framing>::DecBuf>
type Deserializer = CompactProtocolDeserializer<<F as Framing>::DecBuf>
Set up a deserializer from a frame’s buffer.