diff --git a/src/rcore.rs b/src/rcore.rs index f70254d..6e11cd6 100644 --- a/src/rcore.rs +++ b/src/rcore.rs @@ -3,6 +3,7 @@ //! Allows for more generic behaviour via [`Context`], as opposed to original async-only. mod addresses; +mod context; mod diagnostic; mod hashing; mod origin; @@ -18,6 +19,7 @@ use std::{error::Error, rc::Rc}; use crate::func::*; pub use self::addresses::Addresses; +pub use self::context::Context; pub use self::diagnostic::Diagnostic; pub use self::hashing::{Hash, HASH_SIZE, HASH_ZEROS}; pub use self::origin::{OFctr, Origin}; @@ -30,25 +32,6 @@ pub use self::resolution::{ pub use self::serialization::{Deserializer, DeserializerExt, Serializable, Serializer}; pub use self::slice_deserializer::SliceDeserializer; -/// Execution context. -pub trait Context<'a>: 'a { - /// Type to provide for [Monad]ic representation of computation, mostly that of resolution ([`Resolution`]). - type T: Monad<'a>; - - /// Type to allow improved support for result evaluation. - /// This is important for async applications stopping early. - type Fallible: MonadFailAny<'a, T = Self::T>; - - /// See [`Diagnostic`]. - type D: Diagnostic<'a, Self::T>; - - /// Type to represent resolution errors mainly arising in [`Resolver::resolve`]. - type LookupError: 'a + Error; - - /// Get [type@Hash] of a slice, mostly for use in [`Point`]. - fn hash(s: &[u8]) -> Hash; -} - /// Helper alias for [`WeakFunctor::F`] of [`Context::T`]. pub type Wrapped<'a, Ctx, A> = Wrap<'a, A, >::T>; diff --git a/src/rcore/context.rs b/src/rcore/context.rs new file mode 100644 index 0000000..2178186 --- /dev/null +++ b/src/rcore/context.rs @@ -0,0 +1,20 @@ +use super::*; + +/// Execution context. +pub trait Context<'a>: 'a { + /// Type to provide for [Monad]ic representation of computation, mostly that of resolution ([`Resolution`]). + type T: Monad<'a>; + + /// Type to allow improved support for result evaluation. + /// This is important for async applications stopping early. + type Fallible: MonadFailAny<'a, T = Self::T>; + + /// See [`Diagnostic`]. + type D: Diagnostic<'a, Self::T>; + + /// Type to represent resolution errors mainly arising in [`Resolver::resolve`]. + type LookupError: 'a + Error; + + /// Get [type@Hash] of a slice, mostly for use in [`Point`]. + fn hash(s: &[u8]) -> Hash; +}