Move empty final TokenStream handling to server side of bridge
This commit is contained in:
parent
4d45af9e73
commit
af51424008
@ -427,11 +427,7 @@ pub const fn expand1(f: impl Fn(crate::TokenStream) -> crate::TokenStream + Copy
|
||||
Client {
|
||||
get_handle_counters: HandleCounters::get,
|
||||
run: super::selfless_reify::reify_to_extern_c_fn_hrt_bridge(move |bridge| {
|
||||
run_client(bridge, |input| {
|
||||
f(crate::TokenStream(Some(input)))
|
||||
.0
|
||||
.unwrap_or_else(|| TokenStream::concat_streams(None, vec![]))
|
||||
})
|
||||
run_client(bridge, |input| f(crate::TokenStream(Some(input))).0)
|
||||
}),
|
||||
_marker: PhantomData,
|
||||
}
|
||||
@ -446,9 +442,7 @@ pub const fn expand2(
|
||||
get_handle_counters: HandleCounters::get,
|
||||
run: super::selfless_reify::reify_to_extern_c_fn_hrt_bridge(move |bridge| {
|
||||
run_client(bridge, |(input, input2)| {
|
||||
f(crate::TokenStream(Some(input)), crate::TokenStream(Some(input2)))
|
||||
.0
|
||||
.unwrap_or_else(|| TokenStream::concat_streams(None, vec![]))
|
||||
f(crate::TokenStream(Some(input)), crate::TokenStream(Some(input2))).0
|
||||
})
|
||||
}),
|
||||
_marker: PhantomData,
|
||||
|
@ -273,13 +273,17 @@ fn run_server<
|
||||
}
|
||||
|
||||
impl client::Client<crate::TokenStream, crate::TokenStream> {
|
||||
pub fn run<S: Server>(
|
||||
pub fn run<S>(
|
||||
&self,
|
||||
strategy: &impl ExecutionStrategy,
|
||||
server: S,
|
||||
input: S::TokenStream,
|
||||
force_show_panics: bool,
|
||||
) -> Result<S::TokenStream, PanicMessage> {
|
||||
) -> Result<S::TokenStream, PanicMessage>
|
||||
where
|
||||
S: Server,
|
||||
S::TokenStream: Default,
|
||||
{
|
||||
let client::Client { get_handle_counters, run, _marker } = *self;
|
||||
run_server(
|
||||
strategy,
|
||||
@ -289,19 +293,23 @@ pub fn run<S: Server>(
|
||||
run,
|
||||
force_show_panics,
|
||||
)
|
||||
.map(<MarkedTypes<S> as Types>::TokenStream::unmark)
|
||||
.map(|s| <Option<<MarkedTypes<S> as Types>::TokenStream>>::unmark(s).unwrap_or_default())
|
||||
}
|
||||
}
|
||||
|
||||
impl client::Client<(crate::TokenStream, crate::TokenStream), crate::TokenStream> {
|
||||
pub fn run<S: Server>(
|
||||
pub fn run<S>(
|
||||
&self,
|
||||
strategy: &impl ExecutionStrategy,
|
||||
server: S,
|
||||
input: S::TokenStream,
|
||||
input2: S::TokenStream,
|
||||
force_show_panics: bool,
|
||||
) -> Result<S::TokenStream, PanicMessage> {
|
||||
) -> Result<S::TokenStream, PanicMessage>
|
||||
where
|
||||
S: Server,
|
||||
S::TokenStream: Default,
|
||||
{
|
||||
let client::Client { get_handle_counters, run, _marker } = *self;
|
||||
run_server(
|
||||
strategy,
|
||||
@ -314,6 +322,6 @@ pub fn run<S: Server>(
|
||||
run,
|
||||
force_show_panics,
|
||||
)
|
||||
.map(<MarkedTypes<S> as Types>::TokenStream::unmark)
|
||||
.map(|s| <Option<<MarkedTypes<S> as Types>::TokenStream>>::unmark(s).unwrap_or_default())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user