Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pub trait InputPin {}
- pub trait OutputPin {}
- pub trait IoPin {
- type Input: InputPin + IoPin<Input = Self::Input, Output = Self::Output>;
- type Output: OutputPin + IoPin<Input = Self::Input, Output = Self::Output>;
- fn into_input(self) -> Self::Input;
- fn into_output(self) -> Self::Output;
- }
- struct Port<P1, P2> {
- p1: P1,
- p2: P2
- }
- struct Pin;
- impl InputPin for Pin {}
- impl OutputPin for Pin {}
- fn main() {
- }
- fn some_function<P1, P2>(port: &mut Port<P1, P2>)
- where
- P1: IoPin,
- P2: IoPin
- {
- let _p1 = port.p1.into_output();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement