forked from Orchid/orchid
Cleaned up atoms
- Atoms now use MFBI to distinguish between thin and owned atoms. - Introduced TryFromExpr and ToExpr (formerly ToClause) from the old FFI - Standardized on Bottom being a ProjErr, which means that there will be no RTErr
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
pub trait TBool {}
|
||||
pub struct TTrue;
|
||||
impl TBool for TTrue {}
|
||||
pub struct TFalse;
|
||||
impl TBool for TFalse {}
|
||||
|
||||
/// Implementation picker for a tree node
|
||||
///
|
||||
/// Note: This technically allows for the degenerate case
|
||||
/// ```
|
||||
/// struct MyType;
|
||||
/// impl TreeRolePicker for MyType {
|
||||
/// type IsLeaf = TTrue;
|
||||
/// type IsRoot = TTrue;
|
||||
/// }
|
||||
/// ```
|
||||
/// This isn't very useful because it describes a one element sealed hierarchy.
|
||||
pub trait TreeRolePicker {
|
||||
type IsLeaf: TBool;
|
||||
type IsRoot: TBool;
|
||||
}
|
||||
|
||||
pub trait Extends: TreeRolePicker<IsRoot = TFalse> {
|
||||
type Parent: TreeRolePicker<IsLeaf = TFalse>;
|
||||
}
|
||||
|
||||
pub trait Inherits<T> {}
|
||||
|
||||
// impl<T> Inherits<T, 0> for T {}
|
||||
impl<T: Extends, This> Inherits<T::Parent> for This where This: Inherits<T> {}
|
||||
@@ -1,8 +1,3 @@
|
||||
/// [Hierarchy] implementation key. The two implementors of this trait are
|
||||
/// [Base] and [Subtype]. These types are assigned to [InHierarchy::Role] to
|
||||
/// select the implementation of [Hierarchy].
|
||||
pub trait HierarchyRole {}
|
||||
|
||||
/// A type-level boolean suitable to select conditional trait implementations.
|
||||
/// Implementors are [True] and [False]
|
||||
pub trait TLBool {}
|
||||
@@ -13,17 +8,6 @@ impl TLBool for TLTrue {}
|
||||
pub struct TLFalse;
|
||||
impl TLBool for TLFalse {}
|
||||
|
||||
/// Assign this type to [InHierarchy::Role] and implement [Descendant] to create
|
||||
/// a subtype. These types can be upcast to their parent type, conditionally
|
||||
/// downcast from it, and selected for [Descendant::Parent] by other types.
|
||||
pub struct Subtype;
|
||||
impl HierarchyRole for Subtype {}
|
||||
/// Assign this type to [InHierarchy::Role] to create a base type. These types
|
||||
/// are upcast only to themselves, but they can be selected in
|
||||
/// [Descendant::Parent].
|
||||
pub struct Base;
|
||||
impl HierarchyRole for Base {}
|
||||
|
||||
/// A type that implements [Hierarchy]. Used to select implementations of traits
|
||||
/// on the hierarchy
|
||||
pub trait InHierarchy: Clone {
|
||||
|
||||
@@ -6,7 +6,6 @@ mod relations;
|
||||
pub use coding::{Coding, Decode, Encode};
|
||||
pub use helpers::{encode_enum, read_exact, write_exact};
|
||||
pub use hierarchy::{
|
||||
Base, Extends, HierarchyRole, InHierarchy, Subtype, TLBool, TLFalse, TLTrue, UnderRoot,
|
||||
UnderRootImpl,
|
||||
Extends, InHierarchy, TLBool, TLFalse, TLTrue, UnderRoot,
|
||||
};
|
||||
pub use relations::{Channel, MsgSet, Request};
|
||||
|
||||
Reference in New Issue
Block a user