Skip to main content

assert_contract

Function assert_contract 

Source
pub const fn assert_contract<P, T>()
where P: PresetContract, T: PartsContract<Output = <P as PresetContract>::Output>,
Expand description

Force preset and parts output types to match during macro expansion. 在宏展开时强制 preset 与 parts 的输出类型相同。

ⓘ
use nichlink::{assert_contract, PartsContract, PresetContract};

struct Expected;
struct Supplied;
impl PresetContract for Expected {
    type Output = Expected;
    const REQUIRED_PARTS: &'static [&'static str] = &[];
}
impl PartsContract for Supplied {
    type Output = Supplied;
    const PROVIDED_PARTS: &'static [&'static str] = &[];
}

const _: () = assert_contract::<Expected, Supplied>();