You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently the subscription code got refactor where one must reject or accept a subscription manually and because SubscriptionClosed is not treated as an error the closures must not return Result.
However, it's quite awkward to so:
Example:
module
.register_subscription("sub_one_param","sub_one_param","unsub_one_param", |params, pending, _| {// not possible to return Result here.let idx = match params.one::<usize>(){Ok(idx) => (idx, sink),
_ => {
pending.reject("some special error);return;}};let sink = match pending.accept(){Some(sink) => sink,None => return;};
sink.pipe_from_stream(...);}).unwrap();
So it would be more ergonomic / less awkward if it would be possible to do:
module
.register_subscription("sub_one_param","sub_one_param","unsub_one_param", |params, pending, _| {// pending implement drop and will reject the subscription with default errorlet idx = params.one()?;let sink = pending.accept()?;
sink.pipe_from_stream(...);Ok(())}).unwrap();
The tricky part is that if one wants to reject a call explicitly then the error type has to be cloned or borrowed.
So that's rationale why the API is like is at the moment.
The text was updated successfully, but these errors were encountered:
Recently the subscription code got refactor where one must reject or accept a subscription manually and because
SubscriptionClosed
is not treated as an error the closures must not returnResult
.However, it's quite awkward to so:
Example:
So it would be more ergonomic / less awkward if it would be possible to do:
The tricky part is that if one wants to reject a call explicitly then the error type has to be cloned or borrowed.
So that's rationale why the API is like is at the moment.
The text was updated successfully, but these errors were encountered: