[−][src]Trait fbthrift_git::protocol::Protocol
An instance of Protocol glues a Framing implementation to a serializer (ProtocolWriter) and deserializer (ProtocolReader). It constructs, as needed, a serializer to construct a frame with a given protocol, or a deserializer from a frame into a stream of deserialized objects.
Associated Types
type Frame: Framing
Type of the framing implementation
type Sizer: ProtocolWriter<Final = usize>
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: ProtocolWriter<Final = <<Self::Frame as Framing>::EncBuf as BufMutExt>::Final>
Serialize into a buffer. The buffer is allocated with the size computed by Sizer, so it must be large enough.
type Deserializer: ProtocolReader
Set up a deserializer from a frame's buffer.
Associated Constants
const PROTOCOL_ID: ProtocolID
Required methods
fn serializer<SZ, SER>(
sz: SZ,
ser: SER
) -> <Self::Serializer as ProtocolWriter>::Final where
SZ: FnOnce(&mut Self::Sizer),
SER: FnOnce(&mut Self::Serializer),
sz: SZ,
ser: SER
) -> <Self::Serializer as ProtocolWriter>::Final where
SZ: FnOnce(&mut Self::Sizer),
SER: FnOnce(&mut Self::Serializer),
fn deserializer(buf: <Self::Frame as Framing>::DecBuf) -> Self::Deserializer
fn into_buffer(_: Self::Deserializer) -> <Self::Frame as Framing>::DecBuf
Implementors
impl<F> Protocol for BinaryProtocol<F> where
F: Framing + 'static,
[src]
F: Framing + 'static,
type Frame = F
type Sizer = BinaryProtocolSerializer<SizeCounter>
type Serializer = BinaryProtocolSerializer<F::EncBuf>
type Deserializer = BinaryProtocolDeserializer<F::DecBuf>
const PROTOCOL_ID: ProtocolID
[src]
fn serializer<SZ, SER>(
size: SZ,
ser: SER
) -> <Self::Serializer as ProtocolWriter>::Final where
SZ: FnOnce(&mut Self::Sizer),
SER: FnOnce(&mut Self::Serializer),
[src]
size: SZ,
ser: SER
) -> <Self::Serializer as ProtocolWriter>::Final where
SZ: FnOnce(&mut Self::Sizer),
SER: FnOnce(&mut Self::Serializer),
fn deserializer(buf: F::DecBuf) -> Self::Deserializer
[src]
fn into_buffer(deser: Self::Deserializer) -> F::DecBuf
[src]
impl<F> Protocol for CompactProtocol<F> where
F: Framing + 'static,
[src]
F: Framing + 'static,
type Frame = F
type Sizer = CompactProtocolSerializer<SizeCounter>
type Serializer = CompactProtocolSerializer<F::EncBuf>
type Deserializer = CompactProtocolDeserializer<F::DecBuf>
const PROTOCOL_ID: ProtocolID
[src]
fn serializer<SZ, SER>(
size: SZ,
ser: SER
) -> <Self::Serializer as ProtocolWriter>::Final where
SZ: FnOnce(&mut Self::Sizer),
SER: FnOnce(&mut Self::Serializer),
[src]
size: SZ,
ser: SER
) -> <Self::Serializer as ProtocolWriter>::Final where
SZ: FnOnce(&mut Self::Sizer),
SER: FnOnce(&mut Self::Serializer),