#[repr(u8)]pub enum MapKeyType {
Bool,
Int,
Uint,
String,
Dyn,
TypeParam(TypeParamType),
}
Expand description
Types that can be used as map keys.
CEL maps can only use certain types as keys. This enum represents the allowed key types in CEL map literals and map type definitions.
§Examples
use cel_cxx::*;
// String keys are common
let string_key_map = MapType::new(MapKeyType::String, ValueType::Int);
// Integer keys are also supported
let int_key_map = MapType::new(MapKeyType::Int, ValueType::String);
// Check the kind of a key type
assert_eq!(MapKeyType::String.kind(), Kind::String);
§Note
Not all CEL types can be used as map keys. Only primitive types that are hashable and comparable are allowed.
Variants§
Bool
Boolean keys - true
and false
.
Int
Signed integer keys.
Uint
Unsigned integer keys.
String
String keys (most common).
Dyn
Dynamic key type - determined at runtime.
TypeParam(TypeParamType)
Type parameter key type - used in generic contexts.
Implementations§
Source§impl MapKeyType
impl MapKeyType
Sourcepub fn kind(&self) -> Kind
pub fn kind(&self) -> Kind
Returns the kind of this map key type.
This provides the basic category of the key type for type checking and dispatch purposes.
§Examples
use cel_cxx::*;
assert_eq!(MapKeyType::String.kind(), Kind::String);
assert_eq!(MapKeyType::Int.kind(), Kind::Int);
assert_eq!(MapKeyType::Bool.kind(), Kind::Bool);
Trait Implementations§
Source§impl Clone for MapKeyType
impl Clone for MapKeyType
Source§fn clone(&self) -> MapKeyType
fn clone(&self) -> MapKeyType
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for MapKeyType
impl Debug for MapKeyType
Source§impl Display for MapKeyType
impl Display for MapKeyType
Source§impl From<MapKeyType> for ValueType
impl From<MapKeyType> for ValueType
Source§fn from(key: MapKeyType) -> Self
fn from(key: MapKeyType) -> Self
Converts to this type from the input type.
Source§impl Hash for MapKeyType
impl Hash for MapKeyType
Source§impl PartialEq for MapKeyType
impl PartialEq for MapKeyType
Source§impl TryFrom<ValueType> for MapKeyType
impl TryFrom<ValueType> for MapKeyType
impl Eq for MapKeyType
impl StructuralPartialEq for MapKeyType
Auto Trait Implementations§
impl Freeze for MapKeyType
impl RefUnwindSafe for MapKeyType
impl Send for MapKeyType
impl Sync for MapKeyType
impl Unpin for MapKeyType
impl UnwindSafe for MapKeyType
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more