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§
Sourcefn proto_primitive_type() -> &'static str
fn proto_primitive_type() -> &'static str
Returns the protobuf type name for primitives of this type.
Sourcefn proto_primitive_default() -> PrimitiveData
fn proto_primitive_default() -> PrimitiveData
Returns the protobuf-specified default value for this primitive data type.
Sourcefn proto_primitive_data(&self) -> PrimitiveData
fn proto_primitive_data(&self) -> PrimitiveData
Returns the actual value for this primitive data type as a ProtoPrimitiveData variant.
Sourcefn proto_primitive_is_default(&self) -> bool
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
impl ProtoPrimitive for bool
fn proto_primitive_type() -> &'static str
fn proto_primitive_default() -> PrimitiveData
fn proto_primitive_data(&self) -> PrimitiveData
fn proto_primitive_is_default(&self) -> bool
Source§impl ProtoPrimitive for f32
impl ProtoPrimitive for f32
fn proto_primitive_type() -> &'static str
fn proto_primitive_default() -> PrimitiveData
fn proto_primitive_data(&self) -> PrimitiveData
fn proto_primitive_is_default(&self) -> bool
Source§impl ProtoPrimitive for f64
impl ProtoPrimitive for f64
fn proto_primitive_type() -> &'static str
fn proto_primitive_default() -> PrimitiveData
fn proto_primitive_data(&self) -> PrimitiveData
fn proto_primitive_is_default(&self) -> bool
Source§impl ProtoPrimitive for i32
impl ProtoPrimitive for i32
fn proto_primitive_type() -> &'static str
fn proto_primitive_default() -> PrimitiveData
fn proto_primitive_data(&self) -> PrimitiveData
fn proto_primitive_is_default(&self) -> bool
Source§impl ProtoPrimitive for i64
impl ProtoPrimitive for i64
fn proto_primitive_type() -> &'static str
fn proto_primitive_default() -> PrimitiveData
fn proto_primitive_data(&self) -> PrimitiveData
fn proto_primitive_is_default(&self) -> bool
Source§impl ProtoPrimitive for u32
impl ProtoPrimitive for u32
fn proto_primitive_type() -> &'static str
fn proto_primitive_default() -> PrimitiveData
fn proto_primitive_data(&self) -> PrimitiveData
fn proto_primitive_is_default(&self) -> bool
Source§impl ProtoPrimitive for u64
impl ProtoPrimitive for u64
fn proto_primitive_type() -> &'static str
fn proto_primitive_default() -> PrimitiveData
fn proto_primitive_data(&self) -> PrimitiveData
fn proto_primitive_is_default(&self) -> bool
Source§impl ProtoPrimitive for String
impl ProtoPrimitive for String
fn proto_primitive_type() -> &'static str
fn proto_primitive_default() -> PrimitiveData
fn proto_primitive_data(&self) -> PrimitiveData
fn proto_primitive_is_default(&self) -> bool
Source§impl ProtoPrimitive for Vec<u8>
impl ProtoPrimitive for Vec<u8>
fn proto_primitive_type() -> &'static str
fn proto_primitive_default() -> PrimitiveData
fn proto_primitive_data(&self) -> PrimitiveData
fn proto_primitive_is_default(&self) -> bool
Source§impl ProtoPrimitive for Any
impl ProtoPrimitive for Any
fn proto_primitive_type() -> &'static str
fn proto_primitive_default() -> PrimitiveData
fn proto_primitive_data(&self) -> PrimitiveData
fn proto_primitive_is_default(&self) -> bool
Implementors§
impl<T: ProtoEnum> ProtoPrimitive for T
Blanket implementation to make all protobuf enums behave like primitives as well.