Skip to content

Commit 9258087

Browse files
committed
make it possible to assert wire type
1 parent bb177a1 commit 9258087

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

crates/pure-stage/src/lib.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use either::Either;
2-
use std::future::Future;
2+
use std::{future::Future, marker::PhantomData};
33

44
pub struct Zero;
55
pub struct Succ<T: Nat>(T);
@@ -116,14 +116,17 @@ impl Network {
116116
_left_out: L,
117117
_right: &Stage<RIn, ROut>,
118118
_right_in: R,
119-
) where
119+
) -> Wire<<BiasedInput<RIn> as InputExt<R>>::Output>
120+
where
120121
BiasedInput<RIn>: InputExt<R>,
121122
Output<LOut>: OutputExt<L, Input = <BiasedInput<RIn> as InputExt<R>>::Output>,
122123
{
123124
todo!()
124125
}
125126
}
126127

128+
pub struct Wire<T>(PhantomData<T>);
129+
127130
#[cfg(test)]
128131
mod tests {
129132
use super::*;
@@ -264,7 +267,7 @@ mod tests {
264267
let dump_string = network.stage(dump_string);
265268
let dump_client_response = network.stage(dump_client_response);
266269

267-
network.wire(&chain_sync, _1, &dump_string, _0);
268-
network.wire(&chain_sync, _0, &dump_client_response, _0);
270+
let _: Wire<String> = network.wire(&chain_sync, _1, &dump_string, _0);
271+
let _: Wire<ClientResponse> = network.wire(&chain_sync, _0, &dump_client_response, _0);
269272
}
270273
}

0 commit comments

Comments
 (0)