pub struct ProstCodec<E, D> { /* private fields */ }Expand description
Encodes E and decodes D as individual Protobuf payloads.
The directions may use different message types, as is usual for RPC requests and responses. The adapter holds no message data between calls; callers may reuse both the codec and the outbound buffer across messages.
Implementations§
Source§impl<E, D> ProstCodec<E, D>
impl<E, D> ProstCodec<E, D>
Sourcepub const CONTENT_TYPE: &'static str = "application/grpc"
pub const CONTENT_TYPE: &'static str = "application/grpc"
HTTP content type emitted for Protobuf messages.
Sourcepub const fn new() -> ProstCodec<E, D>
pub const fn new() -> ProstCodec<E, D>
Creates a codec for the specified outbound and inbound message types.
Sourcepub fn accepts_content_type(content_type: &str) -> bool
pub fn accepts_content_type(content_type: &str) -> bool
Accepts the default gRPC media type and its explicit Protobuf variant.
Media types are compared case-insensitively, ignoring surrounding HTTP whitespace and optional media type parameters.
Trait Implementations§
Source§impl<E, D> Codec for ProstCodec<E, D>
impl<E, D> Codec for ProstCodec<E, D>
Source§const CONTENT_TYPE: &'static str = Self::CONTENT_TYPE
const CONTENT_TYPE: &'static str = Self::CONTENT_TYPE
HTTP content type identifying this serialization format.
Source§type EncodeItem = E
type EncodeItem = E
Message type accepted by the encoder.
Source§type DecodeItem = D
type DecodeItem = D
Owned message type returned by the decoder.
Source§type Error = ProstCodecError
type Error = ProstCodecError
Serialization or deserialization failure.
Source§impl<E, D> Debug for ProstCodec<E, D>
impl<E, D> Debug for ProstCodec<E, D>
Source§impl<E, D> Default for ProstCodec<E, D>
impl<E, D> Default for ProstCodec<E, D>
Source§fn default() -> ProstCodec<E, D>
fn default() -> ProstCodec<E, D>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<E, D> Freeze for ProstCodec<E, D>
impl<E, D> RefUnwindSafe for ProstCodec<E, D>
impl<E, D> Send for ProstCodec<E, D>
impl<E, D> Sync for ProstCodec<E, D>
impl<E, D> Unpin for ProstCodec<E, D>
impl<E, D> UnsafeUnpin for ProstCodec<E, D>
impl<E, D> UnwindSafe for ProstCodec<E, D>
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