pub enum NoneOr<T> {
None,
Other(T),
}
Expand description
Equivalent of a Rust Option
, where None
is encoded as NoneType
.
Useful for its UnpackValue
instance.
Variants§
Implementations§
Trait Implementations§
source§impl<T: AllocFrozenValue> AllocFrozenValue for NoneOr<T>
impl<T: AllocFrozenValue> AllocFrozenValue for NoneOr<T>
source§fn alloc_frozen_value(self, heap: &FrozenHeap) -> FrozenValue
fn alloc_frozen_value(self, heap: &FrozenHeap) -> FrozenValue
Allocate a value in the frozen heap and return a reference to the allocated value.
source§impl<'v, T: AllocValue<'v>> AllocValue<'v> for NoneOr<T>
impl<'v, T: AllocValue<'v>> AllocValue<'v> for NoneOr<T>
source§impl<T: PartialEq> PartialEq for NoneOr<T>
impl<T: PartialEq> PartialEq for NoneOr<T>
source§impl<T: StarlarkTypeRepr> StarlarkTypeRepr for NoneOr<T>
impl<T: StarlarkTypeRepr> StarlarkTypeRepr for NoneOr<T>
source§fn starlark_type_repr() -> Ty
fn starlark_type_repr() -> Ty
The representation of a type that a user would use verbatim in starlark type annotations
source§impl<'v, T: UnpackValue<'v>> UnpackValue<'v> for NoneOr<T>
impl<'v, T: UnpackValue<'v>> UnpackValue<'v> for NoneOr<T>
source§fn unpack_value(value: Value<'v>) -> Option<Self>
fn unpack_value(value: Value<'v>) -> Option<Self>
Given a
Value
, try and unpack it into the given type, which may involve some element of conversion.source§fn unpack_value_err(value: Value<'v>) -> Result<Self>
fn unpack_value_err(value: Value<'v>) -> Result<Self>
Unpack a value, but return error instead of
None
if unpacking fails.source§fn unpack_param(value: Value<'v>) -> Result<Self>
fn unpack_param(value: Value<'v>) -> Result<Self>
Unpack value, but instead of
None
return error about incorrect argument type.impl<T: Copy> Copy for NoneOr<T>
impl<T: Eq> Eq for NoneOr<T>
impl<T> StructuralPartialEq for NoneOr<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for NoneOr<T>where
T: RefUnwindSafe,
impl<T> Send for NoneOr<T>where
T: Send,
impl<T> Sync for NoneOr<T>where
T: Sync,
impl<T> Unpin for NoneOr<T>where
T: Unpin,
impl<T> UnwindSafe for NoneOr<T>where
T: UnwindSafe,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.