mirror of https://github.com/rust-lang/rust
28 lines
489 B
Rust
28 lines
489 B
Rust
use std::marker::PhantomData;
|
|
|
|
type Component = fn(&());
|
|
|
|
struct Wrapper {
|
|
router: Router<(Component, Box<Self>)>,
|
|
}
|
|
|
|
struct Match<C>(PhantomData<C>);
|
|
|
|
struct Router<T>(PhantomData<T>);
|
|
|
|
impl<T> Router<T> {
|
|
pub fn at(&self) -> Result<Match<&T>, ()> {
|
|
todo!()
|
|
}
|
|
}
|
|
|
|
impl Wrapper {
|
|
fn at(&self, path: &str) -> Result<(Component, Box<Self>), ()> {
|
|
let (cmp, router) = self.router.at()?;
|
|
//~^ ERROR mismatched types
|
|
todo!()
|
|
}
|
|
}
|
|
|
|
fn main() {}
|