Update bromine version

Signed-off-by: Trivernis <trivernis@protonmail.com>
pull/4/head
Trivernis 3 years ago
parent 60fdcb5d74
commit ac3bc9cffd

@ -1,6 +1,6 @@
[package]
name = "mediarepo-api"
version = "0.19.0"
version = "0.20.0"
edition = "2018"
license = "gpl-3"
@ -20,7 +20,7 @@ url = {version = "^2.2.2", optional=true }
pathsearch = {version="^0.2.0", optional=true}
[dependencies.bromine]
version = "^0.16.2"
version = "^0.17.1"
optional = true
features = ["serialize_bincode"]

@ -19,29 +19,23 @@ pub trait IPCApi {
fn namespace() -> &'static str;
fn ctx(&self) -> PoolGuard<Context>;
async fn emit<T: IntoPayload + Send>(
&self,
event_name: &str,
data: T,
) -> ApiResult<EmitMetadata> {
fn emit<T: IntoPayload + Send>(&self, event_name: &str, data: T) -> EmitMetadata<T> {
let ctx = self.ctx();
let meta = ctx.emit_to(Self::namespace(), event_name, data).await?;
Ok(meta)
ctx.emit_to(Self::namespace(), event_name, data)
}
async fn emit_and_get<T: IntoPayload + Send, R: FromPayload + Send>(
async fn emit_and_get<T: IntoPayload + Send + Sync + 'static, R: FromPayload + Send>(
&self,
event_name: &str,
data: T,
timeout: Option<Duration>,
) -> ApiResult<R> {
let mut meta = self.emit(event_name, data).await?;
let mut meta = self.emit(event_name, data).await_reply();
if let Some(timeout) = timeout {
meta = meta.with_timeout(timeout);
}
let response = meta.await_reply(&self.ctx()).await?;
let response = meta.await?;
Ok(response.payload()?)
}
@ -108,7 +102,7 @@ impl ApiClient {
#[tracing::instrument(level = "debug", skip(self))]
pub async fn info(&self) -> ApiResult<InfoResponse> {
let ctx = self.ctx.acquire();
let res = ctx.emit("info", ()).await?.await_reply(&ctx).await?;
let res = ctx.emit("info", ()).await_reply().await?;
Ok(res.payload::<InfoResponse>()?)
}

@ -57,7 +57,7 @@ async fn try_connect_daemon(address: String) -> IPCResult<()> {
.address(address)
.build_client()
.await?;
ctx.emit("info", ()).await?.await_reply(&ctx).await?;
ctx.emit("info", ()).await_reply().await?;
ctx.stop().await?;
Ok(())
}

Loading…
Cancel
Save