use crate::rust::prelude::*;
use crate::traversal::*;
use crate::*;
pub trait CustomTypeKind<L: SchemaTypeLink>: Debug + Clone + PartialEq + Eq {
type CustomTypeValidation: CustomTypeValidation;
}
pub trait CustomTypeValidation: Debug + Clone + PartialEq + Eq {}
pub trait CustomSchema: Debug + Clone + Copy + PartialEq + Eq + 'static {
type CustomTypeValidation: CustomTypeValidation;
type CustomTypeKind<L: SchemaTypeLink>: CustomTypeKind<
L,
CustomTypeValidation = Self::CustomTypeValidation,
>;
fn linearize_type_kind(
type_kind: Self::CustomTypeKind<RustTypeId>,
type_indices: &IndexSet<TypeHash>,
) -> Self::CustomTypeKind<LocalTypeId>;
fn resolve_well_known_type(
well_known_id: WellKnownTypeId,
) -> Option<&'static TypeData<Self::CustomTypeKind<LocalTypeId>, LocalTypeId>>;
fn validate_custom_type_kind(
context: &SchemaContext,
custom_type_kind: &Self::CustomTypeKind<LocalTypeId>,
) -> Result<(), SchemaValidationError>;
fn validate_custom_type_validation(
context: &SchemaContext,
custom_type_kind: &Self::CustomTypeKind<LocalTypeId>,
custom_type_validation: &Self::CustomTypeValidation,
) -> Result<(), SchemaValidationError>;
fn validate_type_metadata_with_custom_type_kind(
context: &SchemaContext,
custom_type_kind: &Self::CustomTypeKind<LocalTypeId>,
type_metadata: &TypeMetadata,
) -> Result<(), SchemaValidationError>;
fn empty_schema() -> &'static Schema<Self>;
}
pub trait CustomExtension: Debug + Clone + PartialEq + Eq + 'static {
const PAYLOAD_PREFIX: u8;
type CustomValueKind: CustomValueKind;
type CustomTraversal: CustomTraversal<CustomValueKind = Self::CustomValueKind>;
type CustomSchema: CustomSchema;
fn custom_value_kind_matches_type_kind(
schema: &Schema<Self::CustomSchema>,
custom_value_kind: Self::CustomValueKind,
type_kind: &TypeKind<
<Self::CustomSchema as CustomSchema>::CustomTypeKind<LocalTypeId>,
LocalTypeId,
>,
) -> bool;
fn custom_type_kind_matches_non_custom_value_kind(
schema: &Schema<Self::CustomSchema>,
custom_type_kind: &<Self::CustomSchema as CustomSchema>::CustomTypeKind<LocalTypeId>,
non_custom_value_kind: ValueKind<Self::CustomValueKind>,
) -> bool;
}