pub struct OptionalType {
pub parameter: Box<ValueType>,
}Expand description
Optional type representing values that may or may not be present.
Optional types wrap another type to indicate that values of that type
may be absent. This is similar to Rust’s Option<T> type.
§Examples
use cel_cxx::*;
// Optional string: optional<string>
let optional_string = OptionalType::new(ValueType::String);
// Optional list: optional<list<int>>
let optional_list = OptionalType::new(
ValueType::List(ListType::new(ValueType::Int))
);Fields§
§parameter: Box<ValueType>The type that may or may not be present.
Implementations§
Trait Implementations§
Source§impl Clone for OptionalType
impl Clone for OptionalType
Source§fn clone(&self) -> OptionalType
fn clone(&self) -> OptionalType
Returns a duplicate of the value. Read more
1.0.0 · 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 OptionalType
impl Debug for OptionalType
Source§impl Display for OptionalType
impl Display for OptionalType
Source§impl From<OptionalType> for ValueType
impl From<OptionalType> for ValueType
Source§fn from(value: OptionalType) -> Self
fn from(value: OptionalType) -> Self
Converts to this type from the input type.
Source§impl Hash for OptionalType
impl Hash for OptionalType
Source§impl PartialEq for OptionalType
impl PartialEq for OptionalType
impl Eq for OptionalType
impl StructuralPartialEq for OptionalType
Auto Trait Implementations§
impl Freeze for OptionalType
impl RefUnwindSafe for OptionalType
impl Send for OptionalType
impl Sync for OptionalType
impl Unpin for OptionalType
impl UnwindSafe for OptionalType
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> 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