Enum prost_reflect::MapKey
source · [−]Expand description
A dynamically-typed key for a protobuf map.
Variants
Bool(bool)
A boolean value, encoded as the bool protobuf type.
I32(i32)
A 32-bit signed integer, encoded as one of the int32, sint32 or sfixed32 protobuf types.
I64(i64)
A 64-bit signed integer, encoded as one of the int64, sint64 or sfixed64 protobuf types.
U32(u32)
A 32-bit unsigned integer, encoded as one of the uint32 or ufixed32 protobuf types.
U64(u64)
A 64-bit unsigned integer, encoded as one of the uint64 or ufixed64 protobuf types.
String(String)
A string, encoded as the string protobuf type.
Implementations
sourceimpl MapKey
impl MapKey
sourcepub fn default_value(kind: &Kind) -> Self
pub fn default_value(kind: &Kind) -> Self
Returns the default value for the given protobuf type kind.
Panics
Panics if kind is not a valid map key type (an integral type or string).
sourcepub fn is_default(&self, kind: &Kind) -> bool
pub fn is_default(&self, kind: &Kind) -> bool
Returns true if this is the default value for the given protobuf type kind.
Panics
Panics if kind is not a valid map key type (an integral type or string).
sourcepub fn is_valid(&self, kind: &Kind) -> bool
pub fn is_valid(&self, kind: &Kind) -> bool
Returns true if this map key can be encoded as the given Kind.
sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
Returns the value if it is a MapKey::Bool, or None if it is any other type.
sourcepub fn as_bool_mut(&mut self) -> Option<&mut bool>
pub fn as_bool_mut(&mut self) -> Option<&mut bool>
Returns a mutable reference to the value if it is a MapKey::Bool, or None if it is any other type.
sourcepub fn as_u32(&self) -> Option<u32>
pub fn as_u32(&self) -> Option<u32>
Returns the value if it is a MapKey::U32, or None if it is any other type.
sourcepub fn as_u32_mut(&mut self) -> Option<&mut u32>
pub fn as_u32_mut(&mut self) -> Option<&mut u32>
Returns a mutable reference to the value if it is a MapKey::U32, or None if it is any other type.
sourcepub fn as_u64(&self) -> Option<u64>
pub fn as_u64(&self) -> Option<u64>
Returns the value if it is a MapKey::U64, or None if it is any other type.
sourcepub fn as_u64_mut(&mut self) -> Option<&mut u64>
pub fn as_u64_mut(&mut self) -> Option<&mut u64>
Returns a mutable reference to the value if it is a MapKey::U64, or None if it is any other type.
sourcepub fn as_i64(&self) -> Option<i64>
pub fn as_i64(&self) -> Option<i64>
Returns the value if it is a MapKey::I64, or None if it is any other type.
sourcepub fn as_i64_mut(&mut self) -> Option<&mut i64>
pub fn as_i64_mut(&mut self) -> Option<&mut i64>
Returns a mutable reference to the value if it is a MapKey::I64, or None if it is any other type.
sourcepub fn as_i32(&self) -> Option<i32>
pub fn as_i32(&self) -> Option<i32>
Returns the value if it is a MapKey::I32, or None if it is any other type.
sourcepub fn as_i32_mut(&mut self) -> Option<&mut i32>
pub fn as_i32_mut(&mut self) -> Option<&mut i32>
Returns a mutable reference to the value if it is a MapKey::I32, or None if it is any other type.
sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
Returns the value if it is a MapKey::String, or None if it is any other type.
sourcepub fn as_string_mut(&mut self) -> Option<&mut String>
pub fn as_string_mut(&mut self) -> Option<&mut String>
Returns a mutable reference to the value if it is a MapKey::String, or None if it is any other type.
Trait Implementations
sourceimpl Ord for MapKey
impl Ord for MapKey
sourceimpl PartialOrd<MapKey> for MapKey
impl PartialOrd<MapKey> for MapKey
sourcefn partial_cmp(&self, other: &MapKey) -> Option<Ordering>
fn partial_cmp(&self, other: &MapKey) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl Eq for MapKey
impl StructuralEq for MapKey
impl StructuralPartialEq for MapKey
Auto Trait Implementations
impl RefUnwindSafe for MapKey
impl Send for MapKey
impl Sync for MapKey
impl Unpin for MapKey
impl UnwindSafe for MapKey
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more