pub struct WithTop<Inner>(/* private fields */);
Expand description
Adds a new “top” value to the nested lattice type.
Given an existing lattice, wrap it into a new lattice with a new top element. The new top element compares as less than all the values of the wrapped lattice. This can be used for giving a sensible default/bottom element to lattices that don’t necessarily have one.
The implementation wraps an Option
, with None
representing the top element.
Implementations§
source§impl<Inner> WithTop<Inner>
impl<Inner> WithTop<Inner>
sourcepub fn new_from(val: impl Into<Option<Inner>>) -> Self
pub fn new_from(val: impl Into<Option<Inner>>) -> Self
Create a new WithTop
lattice instance from a value using Into
.
sourcepub fn as_reveal_ref(&self) -> Option<&Inner>
pub fn as_reveal_ref(&self) -> Option<&Inner>
Reveal the inner value as a shared reference.
sourcepub fn as_reveal_mut(&mut self) -> Option<&mut Inner>
pub fn as_reveal_mut(&mut self) -> Option<&mut Inner>
Reveal the inner value as an exclusive reference.
sourcepub fn into_reveal(self) -> Option<Inner>
pub fn into_reveal(self) -> Option<Inner>
Gets the inner by value, consuming self.
Trait Implementations§
source§impl<Inner> Atomize for WithTop<Inner>
impl<Inner> Atomize for WithTop<Inner>
source§impl<Inner> DeepReveal for WithTop<Inner>where
Inner: DeepReveal,
impl<Inner> DeepReveal for WithTop<Inner>where
Inner: DeepReveal,
source§fn deep_reveal(self) -> Self::Revealed
fn deep_reveal(self) -> Self::Revealed
Reveals the underlying lattice types recursively.
source§impl<'de, Inner> Deserialize<'de> for WithTop<Inner>where
Inner: Deserialize<'de>,
impl<'de, Inner> Deserialize<'de> for WithTop<Inner>where
Inner: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<Inner, Other> LatticeFrom<WithTop<Other>> for WithTop<Inner>where
Inner: LatticeFrom<Other>,
impl<Inner, Other> LatticeFrom<WithTop<Other>> for WithTop<Inner>where
Inner: LatticeFrom<Other>,
source§fn lattice_from(other: WithTop<Other>) -> Self
fn lattice_from(other: WithTop<Other>) -> Self
Convert from the
Other
lattice into Self
.source§impl<Inner, Other> Merge<WithTop<Other>> for WithTop<Inner>where
Inner: Merge<Other> + LatticeFrom<Other>,
impl<Inner, Other> Merge<WithTop<Other>> for WithTop<Inner>where
Inner: Merge<Other> + LatticeFrom<Other>,
source§impl<Inner, Other> PartialEq<WithTop<Other>> for WithTop<Inner>where
Inner: PartialEq<Other>,
impl<Inner, Other> PartialEq<WithTop<Other>> for WithTop<Inner>where
Inner: PartialEq<Other>,
source§impl<Inner, Other> PartialOrd<WithTop<Other>> for WithTop<Inner>where
Inner: PartialOrd<Other>,
impl<Inner, Other> PartialOrd<WithTop<Other>> for WithTop<Inner>where
Inner: PartialOrd<Other>,
impl<Inner: Copy> Copy for WithTop<Inner>
impl<Inner: Eq> Eq for WithTop<Inner>
impl<Inner, Other> LatticeOrd<WithTop<Other>> for WithTop<Inner>where
Self: PartialOrd<WithTop<Other>>,
Auto Trait Implementations§
impl<Inner> Freeze for WithTop<Inner>where
Inner: Freeze,
impl<Inner> RefUnwindSafe for WithTop<Inner>where
Inner: RefUnwindSafe,
impl<Inner> Send for WithTop<Inner>where
Inner: Send,
impl<Inner> Sync for WithTop<Inner>where
Inner: Sync,
impl<Inner> Unpin for WithTop<Inner>where
Inner: Unpin,
impl<Inner> UnwindSafe for WithTop<Inner>where
Inner: 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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§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
Checks if this value is equivalent to the given key. Read more
source§impl<This, Other> NaiveLatticeOrd<Other> for This
impl<This, Other> NaiveLatticeOrd<Other> for This
source§fn naive_cmp(&self, other: &Rhs) -> Option<Ordering>
fn naive_cmp(&self, other: &Rhs) -> Option<Ordering>
Naive compare based on the
Merge::merge
method. This method can be very inefficient;
use PartialOrd::partial_cmp
instead. Read more