Trait tlist::Prefix

source ·
pub trait Prefix<Other: TList> { }
Expand description

Constraint which only holds if a TList is a prefix of Other.

This is not a type-level ‘function’, but rather a constraint you can use to make compiler errors more readable.

Since this is a constraint, and only holds for a small subset of TLists, it is implemented as a separate trait and not as a GAT.

use tlist::*;
use typenum::consts::{U1, U2, U3, U4, U42};

static_assertions::assert_impl_all!(TList![U1, U2]: Prefix<TList![U1, U2, U3, U4]>);
static_assertions::assert_not_impl_any!(TList![U42]: Prefix<TList![U1, U2, U3, U4]>);

Also see EitherPrefix.

Implementors§

source§

impl<H, Ls, Rs: TList> Prefix<TCons<H, Rs>> for TCons<H, Ls>where Ls: Prefix<Rs> + TList,

source§

impl<Other: TList> Prefix<Other> for TNil