Skip to content

Commit

Permalink
Add 84727
Browse files Browse the repository at this point in the history
  • Loading branch information
fanninpm committed Apr 30, 2021
1 parent ecbadf8 commit 9c600cb
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions ices/84727.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
pub struct Color<T>(pub T);

pub struct Cell<Fg, Bg = Fg> {
foreground: Color<Fg>,
background: Color<Bg>,
}

pub trait Over<Bottom, Output> {
fn over(self, bottom: Bottom) -> Output;
}

// Cell: Over<Color, Cell>
impl<C, Fg, Bg, NewFg, NewBg> Over<Color<C>, Cell<NewFg, NewBg>> for Cell<Fg, Bg>
where
Fg: Over<C, NewFg>,
Bg: Over<C, NewBg>,
{
fn over(self, _: Color<C>) -> Cell<NewFg, NewBg> {
todo!();
}
}

// Cell: Over<Cell, Cell>
impl<TopFg, TopBg, BottomFg, BottomBg, NewFg, NewBg>
Over<Cell<BottomFg, BottomBg>, Cell<NewFg, NewBg>> for Cell<TopFg, TopBg>
where
Self: Over<Color<BottomBg>, Cell<NewFg, NewBg>>,
{
fn over(self, bottom: Cell<BottomFg, BottomBg>) -> Cell<NewFg, NewBg> {
self.over(bottom.background);
todo!();
}
}

// Cell: Over<&mut Cell, ()>
impl<'b, TopFg, TopBg, BottomFg, BottomBg> Over<&'b mut Cell<BottomFg, BottomBg>, ()>
for Cell<TopFg, TopBg>
where
Cell<TopFg, TopBg>: Over<Cell<BottomFg, BottomBg>, Cell<BottomFg, BottomBg>>,
{
fn over(self, _: &'b mut Cell<BottomFg, BottomBg>) {
todo!();
}
}

// &Cell: Over<&mut Cell, ()>
impl<'t, 'b, TopFg, TopBg, BottomFg, BottomBg> Over<&'b mut Cell<BottomFg, BottomBg>, ()>
for &'t Cell<TopFg, TopBg>
where
Cell<TopFg, TopBg>: Over<Cell<BottomFg, BottomBg>, Cell<BottomFg, BottomBg>>,
{
fn over(self, _: &'b mut Cell<BottomFg, BottomBg>) {
todo!();
}
}

0 comments on commit 9c600cb

Please sign in to comment.