Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
protocol/service: introduce Result synonym
Fintan Halpenny committed 2 months ago
commit 61a9b2140f1f777ec7504ae58fbd4246deccbb5f
parent 2c19721
1 file changed +7 -2
modified crates/radicle-protocol/src/service/command.rs
@@ -13,7 +13,12 @@ use thiserror::Error;
use super::ServiceState;

/// Function used to query internal service state.
-
pub type QueryState = dyn Fn(&dyn ServiceState) -> Result<(), Error> + Send + Sync;
+
pub type QueryState = dyn Fn(&dyn ServiceState) -> Result<()> + Send + Sync;
+

+
/// A result returned from processing a [`Command`].
+
///
+
/// It is a type synonym for a [`std::result::Result`]
+
pub type Result<T> = std::result::Result<T, Error>;

/// Commands sent to the service by the operator.
pub enum Command {
@@ -45,7 +50,7 @@ pub enum Command {
    /// Unfollow the given node.
    Unfollow(NodeId, Sender<bool>),
    /// Query the internal service state.
-
    QueryState(Arc<QueryState>, Sender<Result<(), Error>>),
+
    QueryState(Arc<QueryState>, Sender<Result<()>>),
}

impl fmt::Debug for Command {