ivo 0.1.1

The rust implementation of the ivo schema valitator
Documentation
#![expect(type_alias_bounds)]

use futures::future::BoxFuture;
use std::{fmt::Debug, sync::Arc};

use crate::{types::InternalIvoContext, IvoStruct};

pub trait FieldValue: Clone + Debug + Send + Sync + 'static {}

impl<T> FieldValue for T where T: Clone + Debug + Send + Sync + 'static {}

// Marker Types
pub struct Yes;
pub struct No;
pub struct YesComputed;
pub trait IsProvided {}
pub trait IsProvidedButNotComputed: IsProvided {}

impl IsProvided for Yes {}
impl IsProvided for YesComputed {}
impl IsProvidedButNotComputed for Yes {}

pub type DeleteHandler<O: IvoStruct, CtxOptions> =
    Box<dyn Fn(Arc<O>, Arc<CtxOptions>) -> BoxFuture<'static, ()> + Send + Sync + 'static>;

pub type FailureHandler<I: IvoStruct, O: IvoStruct, CtxOptions> = Box<
    dyn Fn(Arc<InternalIvoContext<I, O>>, Arc<CtxOptions>) -> BoxFuture<'static, ()>
        + Send
        + Sync
        + 'static,
>;

pub type SuccessHandler<I: IvoStruct, O: IvoStruct, CtxOptions> = Box<
    dyn Fn(Arc<InternalIvoContext<I, O>>, Arc<CtxOptions>) -> BoxFuture<'static, ()>
        + Send
        + Sync
        + 'static,
>;