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 a0f7963
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 44 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.

9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,10 @@ pyo3 = { version = "0.21.2", features = [
"experimental-declarative-modules",
] }
validated_struct = "2.1.0"
zenoh = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["unstable", "internal"], default-features = false }
zenoh-ext = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["internal"], optional = true }
zenoh = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = [
"unstable",
"internal",
], default-features = false }
zenoh-ext = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = [
"internal",
], optional = true }
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 a0f7963

Please sign in to comment.