summary refs log tree commit diff
path: root/rust/src/lib.rs
diff options
context:
space:
mode:
authorV02460 <git@kaialexhiller.de>2024-11-27 11:46:00 +0100
committerGitHub <noreply@github.com>2024-11-27 10:46:00 +0000
commita58f09acc78d2497fc7c3c8930c42233bcc7428c (patch)
tree1d6df1ba6f2116c98d1f9b7b7ebf07f24c75cabf /rust/src/lib.rs
parentMSC4108: Add a Content-Type header on the PUT response (#17253) (diff)
downloadsynapse-a58f09acc78d2497fc7c3c8930c42233bcc7428c.tar.xz
Bump pyo3 to v0.23.2 (#17966)
Keep up-to-date with pyo3 releases. This bump enables Python 3.13
support and resolves deprecations.

Links for quick reference:
https://github.com/PyO3/pyo3/releases
https://github.com/davidhewitt/pythonize/releases
https://github.com/vorner/pyo3-log
Diffstat (limited to 'rust/src/lib.rs')
-rw-r--r--rust/src/lib.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/rust/src/lib.rs b/rust/src/lib.rs

index 5de9238326..d751889874 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs
@@ -1,3 +1,5 @@ +use std::convert::Infallible; + use lazy_static::lazy_static; use pyo3::prelude::*; use pyo3_log::ResetHandle; @@ -52,3 +54,16 @@ fn synapse_rust(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> { Ok(()) } + +pub trait UnwrapInfallible<T> { + fn unwrap_infallible(self) -> T; +} + +impl<T> UnwrapInfallible<T> for Result<T, Infallible> { + fn unwrap_infallible(self) -> T { + match self { + Ok(val) => val, + Err(never) => match never {}, + } + } +}