ProtoPrimitive

Trait ProtoPrimitive 

Source
pub trait ProtoPrimitive: InputNode {
    // Required methods
    fn proto_primitive_type() -> &'static str;
    fn proto_primitive_default() -> PrimitiveData;
    fn proto_primitive_data(&self) -> PrimitiveData;
    fn proto_primitive_is_default(&self) -> bool;
}
Expand description

Trait for Rust types that map to the protobuf primitive types.

Required Methods§

Source

fn proto_primitive_type() -> &'static str

Returns the protobuf type name for primitives of this type.

Source

fn proto_primitive_default() -> PrimitiveData

Returns the protobuf-specified default value for this primitive data type.

Source

fn proto_primitive_data(&self) -> PrimitiveData

Returns the actual value for this primitive data type as a ProtoPrimitiveData variant.

Source

fn proto_primitive_is_default(&self) -> bool

Returns whether this is the default value of the primitive.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ProtoPrimitive for bool

Source§

impl ProtoPrimitive for f32

Source§

impl ProtoPrimitive for f64

Source§

impl ProtoPrimitive for i32

Source§

impl ProtoPrimitive for i64

Source§

impl ProtoPrimitive for u32

Source§

impl ProtoPrimitive for u64

Source§

impl ProtoPrimitive for String

Source§

impl ProtoPrimitive for Vec<u8>

Source§

impl ProtoPrimitive for Any

Implementors§

Source§

impl<T: ProtoEnum> ProtoPrimitive for T

Blanket implementation to make all protobuf enums behave like primitives as well.