pub const fn check_valid_subset<S1: KeySchema, S2: KeySchema, const K: &'static str>() -> usize
where
    S1: ContainsKey<K>,
{
    let with_k: &[&'static str] = &S1::KEYS;
    let without_k: &[&'static str] = &S2::KEYS;

    if with_k.len() <= without_k.len() {
        // panic because S1 isn't bigger
        return (with_k.len() - 1) - without_k.len(); // panic using underflow
    }

    if !is_equivalent_except::<K>(with_k, without_k) {
        // panic because S2 doesn't have the rest of S1's elements
        return (without_k.len() - 1) - with_k.len(); // panic using underflow
    }

    return 1;
}
// Outputs a usize in order to make the array invalid by underflowing
// Alternatively this could use const_panic to produce good error messages
Outputs a usize in order to make the array invalid by underflowing
Alternatively this could use const_panic to produce good error messages
Outputs a usize in order to make the array invalid by underflowing Alternatively this could use const_panic to produce good error messages
pub const fn check_valid_subset<S1: KeySchema, S2: KeySchema, const K: &'static str>() -> usize
where
    S1: ContainsKey<K>,
{
    let with_k: &[&'static str] = &S1::KEYS;
    let without_k: &[&'static str] = &S2::KEYS;
    if with_k.len() <= without_k.len() {
        // panic because S1 isn't bigger
        return (with_k.len() - 1) - without_k.len(); // panic using underflow
    }
    if !is_equivalent_except::<K>(with_k, without_k) {
        // panic because S2 doesn't have the rest of S1's elements
        return (without_k.len() - 1) - with_k.len(); // panic using underflow
    }
    return 1;
}
pub const fn check_valid_subset < S1 : KeySchema , S2 : KeySchema , const K : & ' static str > ( ) -> usize where S1 : ContainsKey < K > , { let with_k : & [ & ' static str ] = & S1 :: KEYS ; let without_k : & [ & ' static str ] = & S2 :: KEYS ; if with_k . len ( ) <= without_k . len ( ) { // panic because S1 isn't bigger return ( with_k . len ( ) - 1 ) - without_k . len ( ) ; // panic using underflow } if ! is_equivalent_except :: < K > ( with_k , without_k ) { // panic because S2 doesn't have the rest of S1's elements return ( without_k . len ( ) - 1 ) - with_k . len ( ) ; // panic using underflow } return 1 ; }
Outputs a usize in order to make the array invalid by underflowing
Alternatively this could use const_panic to produce good error messages
Outputs a usize in order to make the array invalid by underflowing Alternatively this could use const_panic to produce good error messages