Last active
August 26, 2025 10:11
-
-
Save martin-g/440702371a32197c491ed55912d7cbe9 to your computer and use it in GitHub Desktop.
SyncA crate simple usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[synca::synca( | |
#[cfg(feature = "asynch")] | |
pub mod asynch { }, | |
#[cfg(feature = "synch")] | |
pub mod synch { | |
sync!(); | |
replace!( | |
some::AsyncType => some::SyncType, | |
#[tokio::test] => #[test] | |
); | |
} | |
)] | |
mod my_module { | |
pub async fn abc(a: some::AsyncType) -> String { | |
let res = a.method().await; | |
format!("Result: {res}") | |
} | |
#[cfg(test)] | |
mod tests { | |
#[tokio::test] | |
async fn test_abc() {...} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment