Open longshorej opened 5 years ago
I'm unsure whether such a feature is necessary, but filing the issue to gather thoughts.
Result
?
Err
Should we have some sugar to support that use-case? Without any explicit feature, the user might employ a pattern like this:
struct MyMsg; struct MyActor; impl MyActor { fn handle(msg: MyMsg, ctx: &mut ActorContext) -> Result<()> { let thing = some_possible_failure(msg)?; let other_thing = some_other_thing(&thing); Ok(()) } } impl Actor<MyMsg> for MyActor { fn receive(&mut self, msg: MyMsg, ctx: &mut ActorContext) { match self.handle(msg, ctx) { Ok(()) => {} Err(e) => { ctx.fail(e); } }
It feels like that would get repetitive quick, but maybe it's fine.
I'm unsure whether such a feature is necessary, but filing the issue to gather thoughts.
Result
type is great for representing errors.?
operator makes it really easy to work withResult
s.Err
into an actor failureShould we have some sugar to support that use-case? Without any explicit feature, the user might employ a pattern like this:
It feels like that would get repetitive quick, but maybe it's fine.