pub struct InvalidMapKeyType(pub ValueType);
Expand description
Error type for invalid map key type conversions.
InvalidMapKeyType
is returned when attempting to convert a ValueType
to a MapKeyType
fails because the type is not a valid map key type. According to the CEL specification,
only basic comparable types (bool, int, uint, string) can be used as map keys.
§Examples
use cel_cxx::{ValueType, ListType, MapKeyType, InvalidMapKeyType};
// Valid map key type
let string_type = ValueType::String;
let map_key_type = MapKeyType::try_from(string_type).unwrap();
assert_eq!(map_key_type, MapKeyType::String);
// Invalid map key type
let list_type = ValueType::List(ListType::new(ValueType::Int));
let result = MapKeyType::try_from(list_type);
assert!(result.is_err());
Tuple Fields§
§0: ValueType
Implementations§
Trait Implementations§
Source§impl Clone for InvalidMapKeyType
impl Clone for InvalidMapKeyType
Source§fn clone(&self) -> InvalidMapKeyType
fn clone(&self) -> InvalidMapKeyType
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 InvalidMapKeyType
impl Debug for InvalidMapKeyType
Source§impl Display for InvalidMapKeyType
impl Display for InvalidMapKeyType
Source§impl Error for InvalidMapKeyType
impl Error for InvalidMapKeyType
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<InvalidMapKeyType> for Error
impl From<InvalidMapKeyType> for Error
Source§fn from(error: InvalidMapKeyType) -> Self
fn from(error: InvalidMapKeyType) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for InvalidMapKeyType
impl RefUnwindSafe for InvalidMapKeyType
impl Send for InvalidMapKeyType
impl Sync for InvalidMapKeyType
impl Unpin for InvalidMapKeyType
impl UnwindSafe for InvalidMapKeyType
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 moreSource§impl<E> IntoError for E
impl<E> IntoError for E
Source§fn into_error(self) -> Error
fn into_error(self) -> Error
Converts this value into a CEL error. Read more