pub enum CompactProtocol<F = Bytes> {
    __Phantom(CompactProtocol<F>),
    CompactProtocol,
}
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>;

Variants§

§

__Phantom(CompactProtocol<F>)

§

CompactProtocol

Trait Implementations§

source§

impl<F> Clone for CompactProtocol<F>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<F> Protocol for CompactProtocol<F>
where F: Framing + 'static,

§

type Frame = F

Type of the framing implementation
§

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>

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>

Set up a deserializer from a frame’s buffer.
source§

const PROTOCOL_ID: ProtocolID = ProtocolID::CompactProtocol

source§

fn serializer<SZ, SER>( size: SZ, ser: SER ) -> <Self::Serializer as ProtocolWriter>::Final
where SZ: FnOnce(&mut Self::Sizer), SER: FnOnce(&mut Self::Serializer),

source§

fn deserializer(buf: F::DecBuf) -> Self::Deserializer

source§

fn into_buffer(deser: Self::Deserializer) -> F::DecBuf

source§

impl<F> Copy for CompactProtocol<F>

Auto Trait Implementations§

§

impl<F> RefUnwindSafe for CompactProtocol<F>
where F: RefUnwindSafe,

§

impl<F> Send for CompactProtocol<F>
where F: Send,

§

impl<F> Sync for CompactProtocol<F>
where F: Sync,

§

impl<F> Unpin for CompactProtocol<F>

§

impl<F> UnwindSafe for CompactProtocol<F>
where F: RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.