Files
radicle-explorer/crates/radicle-tauri/src/commands.rs
T
Brandon OxendineandRūdolfs Ošiņš 54835363a9 Add a repository identity document view
Adds a read-only page for a repository's identity document. It shows the
current document together with its full revision history. The data and
wording follow heartwood and the rad id / rad inspect CLI.

Co-Authored-By: Rūdolfs Ošiņš <rudolfs@osins.org>
2026-09-24 17:04:54 +02:00

28 lines
952 B
Rust

pub mod auth;
pub mod cob;
pub mod diff;
pub mod identity;
pub mod inbox;
pub mod profile;
pub mod repo;
pub mod startup;
pub mod thread;
use radicle_types::AppState;
use radicle_types::error::Error;
/// Run a blocking, synchronous port method on the async runtime's blocking
/// pool instead of a worker thread. The port methods do blocking libgit2/COB
/// work; running them inline on an `async` command would pin a runtime worker
/// for the call's full duration and let a slow read (e.g. listing refs or
/// jobs) stall every other command queued behind it. Cloning `AppState` is
/// cheap — it only clones the `Profile` (paths and keys, not open handles).
pub(crate) async fn blocking<T, F>(ctx: tauri::State<'_, AppState>, f: F) -> Result<T, Error>
where
F: FnOnce(AppState) -> Result<T, Error> + Send + 'static,
T: Send + 'static,
{
let state = (*ctx).clone();
tauri::async_runtime::spawn_blocking(move || f(state)).await?
}