From 3785c002b708a0e87c00934d5fea9627855c9fdb Mon Sep 17 00:00:00 2001 From: vms Date: Wed, 16 Sep 2020 13:46:38 +0300 Subject: [PATCH] output args separated with comma --- Cargo.lock | 6 +++--- fluence-app-service/Cargo.toml | 4 ++-- fluence-faas/Cargo.toml | 2 +- fluence-faas/src/faas_interface.rs | 19 ++++++++++++++----- tools/repl/Cargo.toml | 4 ++-- 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 43b701ee..87501b30 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -675,7 +675,7 @@ dependencies = [ [[package]] name = "fluence-app-service" -version = "0.1.4" +version = "0.1.5" dependencies = [ "fluence-faas", "log", @@ -686,7 +686,7 @@ dependencies = [ [[package]] name = "fluence-faas" -version = "0.1.4" +version = "0.1.5" dependencies = [ "cmd_lib", "env_logger 0.7.1", @@ -794,7 +794,7 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "frepl" -version = "0.1.7" +version = "0.1.8" dependencies = [ "anyhow", "clap", diff --git a/fluence-app-service/Cargo.toml b/fluence-app-service/Cargo.toml index b8fbeffe..4884d778 100644 --- a/fluence-app-service/Cargo.toml +++ b/fluence-app-service/Cargo.toml @@ -1,13 +1,13 @@ [package] name = "fluence-app-service" description = "Fluence Application Service" -version = "0.1.4" +version = "0.1.5" authors = ["Fluence Labs"] license = "Apache-2.0" edition = "2018" [dependencies] -fluence-faas = { path = "../fluence-faas", version = "0.1.4" } +fluence-faas = { path = "../fluence-faas", version = "0.1.5" } log = "0.4.8" serde_json = "1.0.53" diff --git a/fluence-faas/Cargo.toml b/fluence-faas/Cargo.toml index 80e74a3c..91d0c4d3 100644 --- a/fluence-faas/Cargo.toml +++ b/fluence-faas/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "fluence-faas" description = "Fluence FaaS" -version = "0.1.4" +version = "0.1.5" authors = ["Fluence Labs"] license = "Apache-2.0" edition = "2018" diff --git a/fluence-faas/src/faas_interface.rs b/fluence-faas/src/faas_interface.rs index c1d027fd..2fd4d472 100644 --- a/fluence-faas/src/faas_interface.rs +++ b/fluence-faas/src/faas_interface.rs @@ -23,6 +23,7 @@ use serde::Serializer; use std::fmt; use std::collections::HashMap; +use itertools::Itertools; #[derive(Debug, PartialEq, Clone)] pub struct FaaSInterface<'a> { @@ -69,13 +70,21 @@ impl<'a> fmt::Display for FaaSInterface<'a> { for (name, signature) in functions.iter() { write!(f, " pub fn {}(", name)?; - for arg in signature.arguments { - write!(f, "{}: {}", arg.name, type_text_view(&arg.ty))?; - } + let args = signature + .arguments + .iter() + .map(|arg| format!("{}: {}", arg.name, type_text_view(&arg.ty))) + .join(", "); + if signature.output_types.is_empty() { - writeln!(f, ")")?; + writeln!(f, "{})", args)?; } else if signature.output_types.len() == 1 { - writeln!(f, ") -> {}", type_text_view(&signature.output_types[0]))?; + writeln!( + f, + "{}) -> {}", + args, + type_text_view(&signature.output_types[0]) + )?; } else { // At now, multi values aren't supported - only one output type is possible unimplemented!() diff --git a/tools/repl/Cargo.toml b/tools/repl/Cargo.toml index a58ff2d7..e7f3e46c 100644 --- a/tools/repl/Cargo.toml +++ b/tools/repl/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "frepl" description = "Fluence FCE REPL intended for testing purposes" -version = "0.1.7" +version = "0.1.8" authors = ["Fluence Labs"] repository = "https://github.com/fluencelabs/fce/tools/repl" license = "Apache-2.0" @@ -12,7 +12,7 @@ name = "fce-repl" path = "src/main.rs" [dependencies] -fluence-app-service = { path = "../../fluence-app-service", version = "0.1.4", features = ["raw-module-api"] } +fluence-app-service = { path = "../../fluence-app-service", version = "0.1.5", features = ["raw-module-api"] } anyhow = "1.0.31" clap = "2.33.1"