Open SUPERCILEX opened 2 hours ago
Not much of a problem, but it's annoying to have to match on the error to get my data back:
match e { TrySendError::Full(cmd) => cmd, TrySendError::Disconnected(cmd) => cmd, }
impl std::sync::mpsc::{,Try}SendError<T> { fn into_inner(self) -> T; }
Write the match every time or write your own helper method.
The into_inner method could be bad in the sense that it obviates the need for the user to think about whether or not they should handle Full vs Disconnected errors differently.
into_inner
Just realized you can write it like this which is maybe good enough?
let (TrySendError::Full(cmd) | TrySendError::Disconnected(cmd)) = e;
Proposal
Problem statement
Not much of a problem, but it's annoying to have to match on the error to get my data back:
Solution sketch
Alternatives
Write the match every time or write your own helper method.
The
into_inner
method could be bad in the sense that it obviates the need for the user to think about whether or not they should handle Full vs Disconnected errors differently.