pub struct MapType {
pub key: MapKeyType,
pub value: Box<ValueType>,
}
Expand description
Map type representing key-value mappings.
Map types specify both the type of keys and the type of values. Not all types can be used as map keys - only certain primitive types are allowed.
§Examples
use cel_cxx::*;
// Map from string to int: map<string, int>
let string_to_int = MapType::new(MapKeyType::String, ValueType::Int);
// Map from int to list of strings: map<int, list<string>>
let complex_map = MapType::new(
MapKeyType::Int,
ValueType::List(ListType::new(ValueType::String))
);
Fields§
§key: MapKeyType
The type of keys in this map.
value: Box<ValueType>
The type of values in this map.
Implementations§
Source§impl MapType
impl MapType
Sourcepub fn new(key: MapKeyType, value: ValueType) -> Self
pub fn new(key: MapKeyType, value: ValueType) -> Self
Creates a new map type with the given key and value types.
§Arguments
key
- The type of keys in the mapvalue
- The type of values in the map
§Examples
use cel_cxx::*;
let map_type = MapType::new(MapKeyType::String, ValueType::Int);
assert_eq!(map_type.key(), &MapKeyType::String);
assert_eq!(map_type.value(), &ValueType::Int);
Sourcepub fn key(&self) -> &MapKeyType
pub fn key(&self) -> &MapKeyType
Returns the key type of this map.
§Examples
use cel_cxx::*;
let map_type = MapType::new(MapKeyType::Int, ValueType::String);
assert_eq!(map_type.key(), &MapKeyType::Int);
Trait Implementations§
impl Eq for MapType
impl StructuralPartialEq for MapType
Auto Trait Implementations§
impl Freeze for MapType
impl RefUnwindSafe for MapType
impl Send for MapType
impl Sync for MapType
impl Unpin for MapType
impl UnwindSafe for MapType
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