use std::marker::PhantomData;
use crate::{proposition::Proposition, proven::Proven};
#[allow(clippy::type_complexity)]
pub struct Conditional<S, C, A> {
_phantom: PhantomData<fn(S) -> Result<(), (C, A)>>,
}
impl<S, C, A> Clone for Conditional<S, C, A> {
fn clone(&self) -> Self {
Self {
_phantom: self._phantom,
}
}
}
impl<S, C, A> std::fmt::Debug for Conditional<S, C, A> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("AllOf").finish()
}
}
impl<S, C, A> Proposition<S> for Conditional<S, C, A>
where
C: Proposition<S>,
A: Proposition<S>,
{
}
impl<S, C, A> Proven<S, Conditional<S, C, A>>
where
C: Proposition<S>,
A: Proposition<S>,
{
#[inline]
pub fn from_proven(v: Proven<S, C>) -> Self {
unsafe { Self::new_unchecked(v.into_subject()) }
}
#[inline]
pub unsafe fn promise_condition(self) -> Proven<S, C> {
Proven::new_unchecked(self.into_subject())
}
}