diff --git a/src/rcore.rs b/src/rcore.rs index eb30212..f70254d 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 diagnostic; mod hashing; mod origin; mod point; @@ -17,6 +18,7 @@ use std::{error::Error, rc::Rc}; use crate::func::*; pub use self::addresses::Addresses; +pub use self::diagnostic::Diagnostic; pub use self::hashing::{Hash, HASH_SIZE, HASH_ZEROS}; pub use self::origin::{OFctr, Origin}; pub use self::point::Point; @@ -28,22 +30,6 @@ pub use self::resolution::{ pub use self::serialization::{Deserializer, DeserializerExt, Serializable, Serializer}; pub use self::slice_deserializer::SliceDeserializer; -/// Basic support for tracing events across the execution. -pub trait Diagnostic<'a, T: Monad<'a>> { - /// Specify that the evaluation happens after a specific event. - fn after<'b, A: 'a>(fa: T::F, event: impl 'b + FnOnce() -> String) -> T::F - where - 'a: 'b; - /// Specify that the evaluation happens before a specific event. - fn before<'b, A: 'a>(fa: T::F, event: impl 'b + FnOnce() -> String) -> T::F - where - 'a: 'b; - /// Label the evaluation step as a specific named action. - fn wrapped<'b, A: 'a>(fa: T::F, event: impl 'b + FnOnce() -> String) -> T::F - where - 'a: 'b; -} - /// Execution context. pub trait Context<'a>: 'a { /// Type to provide for [Monad]ic representation of computation, mostly that of resolution ([`Resolution`]). diff --git a/src/rcore/diagnostic.rs b/src/rcore/diagnostic.rs new file mode 100644 index 0000000..9249bf3 --- /dev/null +++ b/src/rcore/diagnostic.rs @@ -0,0 +1,17 @@ +use crate::func::Monad; + +/// Basic support for tracing events across the execution. +pub trait Diagnostic<'a, T: Monad<'a>> { + /// Specify that the evaluation happens after a specific event. + fn after<'b, A: 'a>(fa: T::F, event: impl 'b + FnOnce() -> String) -> T::F + where + 'a: 'b; + /// Specify that the evaluation happens before a specific event. + fn before<'b, A: 'a>(fa: T::F, event: impl 'b + FnOnce() -> String) -> T::F + where + 'a: 'b; + /// Label the evaluation step as a specific named action. + fn wrapped<'b, A: 'a>(fa: T::F, event: impl 'b + FnOnce() -> String) -> T::F + where + 'a: 'b; +}