daemonic_error 1.0.0

Errors that compose, predict, and leave receipts - Compose: algebraic combination (in active development) - Predict: Glass/Severity - Receipts: audit trail, position, checksum - Reflection: Runtime Reflection through TopologySegment (in active development)
use crate::daemonic::glass::Glass;
use crate::DaemonicError;

/// Irreversible transformation. State cannot be trusted.
/// What came back is not what was sent.
/// Non-reversible by definition.
pub trait GlassWarped<GLASS>: Glass<GLASS> + for<'error> DaemonicError<'error> {
	/// What was the state before warping? (if recoverable for inspection)
	fn prior_state(&self) -> Option<&GLASS>;
	
	/// What caused the warped?
	fn warp_description(&self) -> &str;
	fn repair(&self) -> Option<&dyn Fn() -> GLASS> { None }
	fn should_continue(&self) -> bool { false }
}
/// Annotation on a Warped observation.
/// "State is corrupted, here's the transformation that happened."
pub trait WarpedAnnotation<GLASS>: GlassWarped<GLASS> {
	fn annotation(&self) -> &str;
	
	/// Description of the transformation.
	fn transformation_description(&self) -> &str;
}