pub enum ScalarType {
Show 15 variants
Double,
Float,
Int64,
Uint64,
Int32,
Fixed64,
Fixed32,
Bool,
String,
Bytes,
Uint32,
Sfixed32,
Sfixed64,
Sint32,
Sint64,
}Expand description
Protobuf scalar field types.
This is field_descriptor_proto::Type minus
TYPE_MESSAGE, TYPE_GROUP, and TYPE_ENUM — those get dedicated
SingularKind variants instead of being lumped in with scalars.
Variants§
Double
Float
Int64
Uint64
Int32
Fixed64
Fixed32
Bool
String
Bytes
Uint32
Sfixed32
Sfixed64
Sint32
Sint64
Implementations§
Source§impl ScalarType
impl ScalarType
Sourcepub fn from_proto(ty: ProtoType) -> Option<Self>
pub fn from_proto(ty: ProtoType) -> Option<Self>
Convert a raw proto Type to a ScalarType.
Returns None for TYPE_MESSAGE, TYPE_GROUP, and TYPE_ENUM,
which are not scalar.
Sourcepub fn is_valid_map_key(self) -> bool
pub fn is_valid_map_key(self) -> bool
Whether this scalar is valid as a protobuf map key.
Per the protobuf spec: integral types, bool, and string. Not floats, not bytes.
Trait Implementations§
Source§impl Clone for ScalarType
impl Clone for ScalarType
Source§fn clone(&self) -> ScalarType
fn clone(&self) -> ScalarType
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ScalarType
impl Debug for ScalarType
Source§impl Hash for ScalarType
impl Hash for ScalarType
Source§impl PartialEq for ScalarType
impl PartialEq for ScalarType
Source§fn eq(&self, other: &ScalarType) -> bool
fn eq(&self, other: &ScalarType) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for ScalarType
impl Eq for ScalarType
impl StructuralPartialEq for ScalarType
Auto Trait Implementations§
impl Freeze for ScalarType
impl RefUnwindSafe for ScalarType
impl Send for ScalarType
impl Sync for ScalarType
impl Unpin for ScalarType
impl UnsafeUnpin for ScalarType
impl UnwindSafe for ScalarType
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