Trait ntex_grpc::types::NativeType
source · pub trait NativeType: PartialEq + Default + Sized + Debug {
const TYPE: WireType;
// Required methods
fn merge(&mut self, src: &mut Bytes) -> Result<(), DecodeError>;
fn encode_value(&self, dst: &mut BytesMut);
// Provided methods
fn value_len(&self) -> usize { ... }
fn is_default(&self) -> bool { ... }
fn encode_type(&self, tag: u32, dst: &mut BytesMut) { ... }
fn encoded_len(&self, tag: u32) -> usize { ... }
fn serialize(
&self,
tag: u32,
default: DefaultValue<&Self>,
dst: &mut BytesMut
) { ... }
fn serialized_len(&self, tag: u32, default: DefaultValue<&Self>) -> usize { ... }
fn deserialize(
&mut self,
_: u32,
wtype: WireType,
src: &mut Bytes
) -> Result<(), DecodeError> { ... }
fn deserialize_default(
tag: u32,
wtype: WireType,
src: &mut Bytes
) -> Result<Self, DecodeError> { ... }
}Expand description
Protobuf type serializer
Required Associated Constants§
Required Methods§
sourcefn encode_value(&self, dst: &mut BytesMut)
fn encode_value(&self, dst: &mut BytesMut)
Encode field value
Provided Methods§
sourcefn value_len(&self) -> usize
fn value_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
sourcefn is_default(&self) -> bool
fn is_default(&self) -> bool
Check if value is default
sourcefn encode_type(&self, tag: u32, dst: &mut BytesMut)
fn encode_type(&self, tag: u32, dst: &mut BytesMut)
Encode field tag and length
sourcefn encoded_len(&self, tag: u32) -> usize
fn encoded_len(&self, tag: u32) -> usize
Protobuf field length
sourcefn serialize(&self, tag: u32, default: DefaultValue<&Self>, dst: &mut BytesMut)
fn serialize(&self, tag: u32, default: DefaultValue<&Self>, dst: &mut BytesMut)
Serialize protobuf field
sourcefn serialized_len(&self, tag: u32, default: DefaultValue<&Self>) -> usize
fn serialized_len(&self, tag: u32, default: DefaultValue<&Self>) -> usize
Protobuf field length
sourcefn deserialize(
&mut self,
_: u32,
wtype: WireType,
src: &mut Bytes
) -> Result<(), DecodeError>
fn deserialize( &mut self, _: u32, wtype: WireType, src: &mut Bytes ) -> Result<(), DecodeError>
Deserialize protobuf field
sourcefn deserialize_default(
tag: u32,
wtype: WireType,
src: &mut Bytes
) -> Result<Self, DecodeError>
fn deserialize_default( tag: u32, wtype: WireType, src: &mut Bytes ) -> Result<Self, DecodeError>
Deserialize protobuf field to default value
Object Safety§
This trait is not object safe.
Implementations on Foreign Types§
source§impl NativeType for bool
impl NativeType for bool
source§impl NativeType for i32
impl NativeType for i32
source§impl NativeType for i64
impl NativeType for i64
source§impl NativeType for u32
impl NativeType for u32
source§impl NativeType for u64
impl NativeType for u64
source§impl NativeType for String
impl NativeType for String
source§impl NativeType for Vec<u8>
impl NativeType for Vec<u8>
source§impl NativeType for Bytes
impl NativeType for Bytes
source§impl NativeType for ByteString
impl NativeType for ByteString
source§impl<K: NativeType + Eq + Hash, V: NativeType, S: BuildHasher + Default> NativeType for HashMap<K, V, S>
impl<K: NativeType + Eq + Hash, V: NativeType, S: BuildHasher + Default> NativeType for HashMap<K, V, S>
source§fn encode_value(&self, _: &mut BytesMut)
fn encode_value(&self, _: &mut BytesMut)
Serialize field value
source§fn deserialize(
&mut self,
_: u32,
wtype: WireType,
src: &mut Bytes
) -> Result<(), DecodeError>
fn deserialize( &mut self, _: u32, wtype: WireType, src: &mut Bytes ) -> Result<(), DecodeError>
Deserialize protobuf field
source§fn serialize(&self, tag: u32, _: DefaultValue<&Self>, dst: &mut BytesMut)
fn serialize(&self, tag: u32, _: DefaultValue<&Self>, dst: &mut BytesMut)
Serialize protobuf field
source§fn encoded_len(&self, tag: u32) -> usize
fn encoded_len(&self, tag: u32) -> usize
Generic protobuf map encode function with an overridden value default.
const TYPE: WireType = WireType::LengthDelimited
fn is_default(&self) -> bool
source§impl<T: NativeType> NativeType for Option<T>
impl<T: NativeType> NativeType for Option<T>
source§fn encode_value(&self, _: &mut BytesMut)
fn encode_value(&self, _: &mut BytesMut)
Serialize field value
source§fn deserialize(
&mut self,
tag: u32,
wtype: WireType,
src: &mut Bytes
) -> Result<(), DecodeError>
fn deserialize( &mut self, tag: u32, wtype: WireType, src: &mut Bytes ) -> Result<(), DecodeError>
Deserialize protobuf field
source§fn serialize(&self, tag: u32, _: DefaultValue<&Self>, dst: &mut BytesMut)
fn serialize(&self, tag: u32, _: DefaultValue<&Self>, dst: &mut BytesMut)
Serialize protobuf field
source§fn serialized_len(&self, tag: u32, _: DefaultValue<&Self>) -> usize
fn serialized_len(&self, tag: u32, _: DefaultValue<&Self>) -> usize
Protobuf field length
source§fn encoded_len(&self, tag: u32) -> usize
fn encoded_len(&self, tag: u32) -> usize
Protobuf field length
const TYPE: WireType = WireType::LengthDelimited
fn is_default(&self) -> bool
source§impl<T: NativeType> NativeType for Vec<T>
impl<T: NativeType> NativeType for Vec<T>
source§fn encode_value(&self, _: &mut BytesMut)
fn encode_value(&self, _: &mut BytesMut)
Serialize field value
source§fn deserialize(
&mut self,
tag: u32,
wtype: WireType,
src: &mut Bytes
) -> Result<(), DecodeError>
fn deserialize( &mut self, tag: u32, wtype: WireType, src: &mut Bytes ) -> Result<(), DecodeError>
Deserialize protobuf field
source§fn serialize(&self, tag: u32, _: DefaultValue<&Self>, dst: &mut BytesMut)
fn serialize(&self, tag: u32, _: DefaultValue<&Self>, dst: &mut BytesMut)
Serialize protobuf field
source§fn encoded_len(&self, tag: u32) -> usize
fn encoded_len(&self, tag: u32) -> usize
Protobuf field length