diff options
author | Erik Johnston <erik@matrix.org> | 2022-09-12 11:03:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-12 10:03:42 +0000 |
commit | ebfeac7c5ded851a2639911ec6adf9d0fcdb029a (patch) | |
tree | 972049d45c5fed1241ee4820705033cbba784d5f /rust/src | |
parent | Concurrently collect room unread counts for push badges (#13765) (diff) | |
download | synapse-ebfeac7c5ded851a2639911ec6adf9d0fcdb029a.tar.xz |
Check if Rust lib needs rebuilding. (#13759)
This protects against the common mistake of failing to remember to rebuild Rust code after making changes.
Diffstat (limited to 'rust/src')
-rw-r--r-- | rust/src/lib.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 142fc2ed93..ba42465fb8 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -1,5 +1,13 @@ use pyo3::prelude::*; +/// Returns the hash of all the rust source files at the time it was compiled. +/// +/// Used by python to detect if the rust library is outdated. +#[pyfunction] +fn get_rust_file_digest() -> &'static str { + env!("SYNAPSE_RUST_DIGEST") +} + /// Formats the sum of two numbers as string. #[pyfunction] #[pyo3(text_signature = "(a, b, /)")] @@ -11,6 +19,6 @@ fn sum_as_string(a: usize, b: usize) -> PyResult<String> { #[pymodule] fn synapse_rust(_py: Python<'_>, m: &PyModule) -> PyResult<()> { m.add_function(wrap_pyfunction!(sum_as_string, m)?)?; - + m.add_function(wrap_pyfunction!(get_rust_file_digest, m)?)?; Ok(()) } |