Struct lattices::Point

source ·
#[repr(transparent)]
pub struct Point<T, Provenance> { pub val: T, /* private fields */ }
Expand description

A Point lattice, corresponding to a single instance of T.

Will runtime panic if a merge between inequal values is attempted.

The Provenance generic param is a token for the origin of this point. The parameter can be used to differentiate between points with different provenances. This will prevent them from being merged together, avoiding any posibility of panic.

Like Conflict<T> but will panic instead of going to a “conflict” top state.

Can be thought of as a lattice with a domain of size one, corresponding to the specific value inside.

This also can be used to wrap non lattice data into a lattice in a way that typechecks.

Fields§

§val: T

The value stored inside. This should not be mutated.

Implementations§

source§

impl<T, Provenance> Point<T, Provenance>

source

pub fn new(val: T) -> Self

Create a new Point lattice instance from a value.

source

pub fn new_from(val: impl Into<T>) -> Self

Create a new Point lattice instance from a value using Into.

Trait Implementations§

source§

impl<T: Clone, Provenance: Clone> Clone for Point<T, Provenance>

source§

fn clone(&self) -> Point<T, Provenance>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug, Provenance: Debug> Debug for Point<T, Provenance>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T, Provenance> DeepReveal for Point<T, Provenance>

§

type Revealed = T

The underlying type when revealed.
source§

fn deep_reveal(self) -> Self::Revealed

Reveals the underlying lattice types recursively.
source§

impl<T: Default, Provenance: Default> Default for Point<T, Provenance>

source§

fn default() -> Point<T, Provenance>

Returns the “default value” for a type. Read more
source§

impl<'de, T, Provenance> Deserialize<'de> for Point<T, Provenance>
where T: Deserialize<'de>,

source§

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<T, Provenance> IsBot for Point<T, Provenance>

source§

fn is_bot(&self) -> bool

Returns if self is lattice bottom (⊥). Read more
source§

impl<T, Provenance> IsTop for Point<T, Provenance>

source§

fn is_top(&self) -> bool

Returns if self is lattice top (⊤). Read more
source§

impl<T, Provenance> LatticeFrom<Point<T, Provenance>> for Point<T, Provenance>

source§

fn lattice_from(other: Point<T, Provenance>) -> Self

Convert from the Other lattice into Self.
source§

impl<T, Provenance> Merge<Point<T, Provenance>> for Point<T, Provenance>
where T: PartialEq,

source§

fn merge(&mut self, other: Point<T, Provenance>) -> bool

Merge other into the self lattice. Read more
source§

fn merge_owned(this: Self, delta: Other) -> Self
where Self: Sized,

Merge this and delta together, returning the new value.
source§

impl<T, Provenance> PartialEq for Point<T, Provenance>
where T: PartialEq,

source§

fn eq(&self, other: &Point<T, Provenance>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T, Provenance> PartialOrd for Point<T, Provenance>
where T: PartialEq,

source§

fn partial_cmp(&self, other: &Point<T, Provenance>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T, Provenance> Serialize for Point<T, Provenance>
where T: Serialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T: Copy, Provenance: Copy> Copy for Point<T, Provenance>

source§

impl<T: Eq, Provenance: Eq> Eq for Point<T, Provenance>

source§

impl<T, Provenance> LatticeOrd for Point<T, Provenance>
where Self: PartialOrd<Point<T, Provenance>>,

Auto Trait Implementations§

§

impl<T, Provenance> Freeze for Point<T, Provenance>
where T: Freeze,

§

impl<T, Provenance> RefUnwindSafe for Point<T, Provenance>
where T: RefUnwindSafe, Provenance: RefUnwindSafe,

§

impl<T, Provenance> !Send for Point<T, Provenance>

§

impl<T, Provenance> !Sync for Point<T, Provenance>

§

impl<T, Provenance> Unpin for Point<T, Provenance>
where T: Unpin,

§

impl<T, Provenance> UnwindSafe for Point<T, Provenance>
where T: UnwindSafe, Provenance: RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<This, Other> NaiveLatticeOrd<Other> for This
where This: Clone + Merge<Other>, Other: Clone + Merge<This>,

source§

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
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> Lattice for T