From 937ed200ffdaca4ecc0c65f8630968483361fbe4 Mon Sep 17 00:00:00 2001 From: Przemyslaw Walski Date: Wed, 28 Jun 2023 04:15:11 +0200 Subject: [PATCH] Unified anyhow result return types --- core/gsb-api/src/lib.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/core/gsb-api/src/lib.rs b/core/gsb-api/src/lib.rs index 64674b8064..f00d31b162 100644 --- a/core/gsb-api/src/lib.rs +++ b/core/gsb-api/src/lib.rs @@ -41,7 +41,7 @@ impl GsbApiService { pub(crate) type GsbError = ya_service_bus::Error; #[derive(Message, Serialize, Deserialize, Debug)] -#[rtype(result = "Result<(), anyhow::Error>")] +#[rtype(result = "anyhow::Result<()>")] struct WsRequest { id: String, component: String, @@ -49,7 +49,7 @@ struct WsRequest { } #[derive(Message, Debug)] -#[rtype(result = "Result<(), anyhow::Error>")] +#[rtype(result = "anyhow::Result<()>")] pub(crate) struct WsResponse { pub id: String, pub response: WsResponseMsg, @@ -373,10 +373,7 @@ mod flexbuffer_util { } } - pub(crate) fn read_string( - reader: &MapReader<&[u8]>, - key: &str, - ) -> Result { + pub(crate) fn read_string(reader: &MapReader<&[u8]>, key: &str) -> anyhow::Result { match reader.index(key) { Ok(field) => match field.get_str() { Ok(txt) => Ok(txt.to_string()), @@ -389,7 +386,7 @@ mod flexbuffer_util { pub(crate) fn as_map<'a>( reader: &Reader<&'a [u8]>, allow_empty: bool, - ) -> Result, anyhow::Error> { + ) -> anyhow::Result> { match reader.get_map() { Ok(map) => { if allow_empty || !map.is_empty() {