rcore::diagnostic
This commit is contained in:
parent
8d3593cf2d
commit
8997900157
18
src/rcore.rs
18
src/rcore.rs
@ -3,6 +3,7 @@
|
|||||||
//! Allows for more generic behaviour via [`Context`], as opposed to original async-only.
|
//! Allows for more generic behaviour via [`Context`], as opposed to original async-only.
|
||||||
|
|
||||||
mod addresses;
|
mod addresses;
|
||||||
|
mod diagnostic;
|
||||||
mod hashing;
|
mod hashing;
|
||||||
mod origin;
|
mod origin;
|
||||||
mod point;
|
mod point;
|
||||||
@ -17,6 +18,7 @@ use std::{error::Error, rc::Rc};
|
|||||||
use crate::func::*;
|
use crate::func::*;
|
||||||
|
|
||||||
pub use self::addresses::Addresses;
|
pub use self::addresses::Addresses;
|
||||||
|
pub use self::diagnostic::Diagnostic;
|
||||||
pub use self::hashing::{Hash, HASH_SIZE, HASH_ZEROS};
|
pub use self::hashing::{Hash, HASH_SIZE, HASH_ZEROS};
|
||||||
pub use self::origin::{OFctr, Origin};
|
pub use self::origin::{OFctr, Origin};
|
||||||
pub use self::point::Point;
|
pub use self::point::Point;
|
||||||
@ -28,22 +30,6 @@ pub use self::resolution::{
|
|||||||
pub use self::serialization::{Deserializer, DeserializerExt, Serializable, Serializer};
|
pub use self::serialization::{Deserializer, DeserializerExt, Serializable, Serializer};
|
||||||
pub use self::slice_deserializer::SliceDeserializer;
|
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<A>, event: impl 'b + FnOnce() -> String) -> T::F<A>
|
|
||||||
where
|
|
||||||
'a: 'b;
|
|
||||||
/// Specify that the evaluation happens before a specific event.
|
|
||||||
fn before<'b, A: 'a>(fa: T::F<A>, event: impl 'b + FnOnce() -> String) -> T::F<A>
|
|
||||||
where
|
|
||||||
'a: 'b;
|
|
||||||
/// Label the evaluation step as a specific named action.
|
|
||||||
fn wrapped<'b, A: 'a>(fa: T::F<A>, event: impl 'b + FnOnce() -> String) -> T::F<A>
|
|
||||||
where
|
|
||||||
'a: 'b;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Execution context.
|
/// Execution context.
|
||||||
pub trait Context<'a>: 'a {
|
pub trait Context<'a>: 'a {
|
||||||
/// Type to provide for [Monad]ic representation of computation, mostly that of resolution ([`Resolution`]).
|
/// Type to provide for [Monad]ic representation of computation, mostly that of resolution ([`Resolution`]).
|
||||||
|
17
src/rcore/diagnostic.rs
Normal file
17
src/rcore/diagnostic.rs
Normal file
@ -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<A>, event: impl 'b + FnOnce() -> String) -> T::F<A>
|
||||||
|
where
|
||||||
|
'a: 'b;
|
||||||
|
/// Specify that the evaluation happens before a specific event.
|
||||||
|
fn before<'b, A: 'a>(fa: T::F<A>, event: impl 'b + FnOnce() -> String) -> T::F<A>
|
||||||
|
where
|
||||||
|
'a: 'b;
|
||||||
|
/// Label the evaluation step as a specific named action.
|
||||||
|
fn wrapped<'b, A: 'a>(fa: T::F<A>, event: impl 'b + FnOnce() -> String) -> T::F<A>
|
||||||
|
where
|
||||||
|
'a: 'b;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user