Skip to content

Instantly share code, notes, and snippets.

@martin-g
Last active August 26, 2025 10:11
Show Gist options
  • Save martin-g/440702371a32197c491ed55912d7cbe9 to your computer and use it in GitHub Desktop.
Save martin-g/440702371a32197c491ed55912d7cbe9 to your computer and use it in GitHub Desktop.
SyncA crate simple usage
#[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