Skip to content

Commit

Permalink
Sync lockfile with Zenoh e9f3b37 from 2024-10-08
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzypixelz committed Oct 8, 2024
1 parent 724d7fa commit a3f7533
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 42 deletions.
52 changes: 26 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 25 additions & 16 deletions src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,19 @@ fn recv<T: IntoPython, E: IntoPyErr + Send>(
}
}

enum DeadlineError<E> {
Timeout,
Error(E),
}
impl<E: fmt::Display> fmt::Display for DeadlineError<E> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Error(err) => write!(f, "{err}"),
Self::Timeout => unreachable!(),
}
}
}

impl<T: IntoRust> Receiver for RustHandler<DefaultHandler, T>
where
T::Into: IntoPython,
Expand All @@ -295,8 +308,12 @@ where
fn recv(&self, py: Python) -> PyResult<PyObject> {
recv(
py,
|| self.handler.recv_timeout(CHECK_SIGNALS_INTERVAL),
|err| matches!(err, flume::RecvTimeoutError::Timeout),
|| match self.handler.recv_timeout(CHECK_SIGNALS_INTERVAL) {
Ok(Some(x)) => Ok(x),
Ok(None) => Err(DeadlineError::Timeout),
Err(err) => Err(DeadlineError::Error(err)),
},
|err| matches!(err, DeadlineError::Timeout),
)
}
}
Expand All @@ -316,8 +333,12 @@ where
fn recv(&self, py: Python) -> PyResult<PyObject> {
recv(
py,
|| self.handler.recv_timeout(CHECK_SIGNALS_INTERVAL),
|err| matches!(err, flume::RecvTimeoutError::Timeout),
|| match self.handler.recv_timeout(CHECK_SIGNALS_INTERVAL) {
Ok(Some(x)) => Ok(x),
Ok(None) => Err(DeadlineError::Timeout),
Err(err) => Err(DeadlineError::Error(err)),
},
|err| matches!(err, DeadlineError::Timeout),
)
}
}
Expand All @@ -335,18 +356,6 @@ where
}

fn recv(&self, py: Python) -> PyResult<PyObject> {
enum DeadlineError<E> {
Timeout,
Error(E),
}
impl<E: fmt::Display> fmt::Display for DeadlineError<E> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Error(err) => write!(f, "{err}"),
Self::Timeout => unreachable!(),
}
}
}
recv(
py,
|| match self.handler.recv_timeout(CHECK_SIGNALS_INTERVAL) {
Expand Down

0 comments on commit a3f7533

Please sign in to comment.