Skip to content

Commit

Permalink
Merge pull request #1 from SwissDataScienceCenter/tokio
Browse files Browse the repository at this point in the history
Add tokio and use async reqwest http client
  • Loading branch information
eikek authored Jun 28, 2024
2 parents b1448e9 + 0cfce2f commit 2c612ae
Show file tree
Hide file tree
Showing 15 changed files with 202 additions and 61 deletions.
129 changes: 129 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ reqwest = { version = "0.12.5", default-features = false, features = ["json", "b
serde = { version = "1.0.203", features = ["derive"] }
serde_json = "1.0.118"
snafu = { version = "0.8.3" }
tokio = { version = "1", features = ["full"] }
futures = { version = "0.3" }

[features]
default = ["reqwest/default-tls"] # link against system library
Expand Down
24 changes: 12 additions & 12 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
craneLib = crane.mkLib pkgs;
src = craneLib.cleanCargoSource ./.;

fenixToolChain = fenix.packages.${system}.complete;

# Common arguments can be set here to avoid repeating them later
commonArgs = {
inherit src;
Expand All @@ -65,7 +67,7 @@

craneLibLLvmTools =
craneLib.overrideToolchain
(fenix.packages.${system}.complete.withComponents [
(fenixToolChain.withComponents [
"cargo"
"llvm-tools"
"rustc"
Expand Down Expand Up @@ -152,6 +154,8 @@
# Inherit inputs from checks.
checks = self.checks.${system};

RUST_SRC_PATH = "${fenixToolChain.rust-src}/lib/rustlib/src/rust/library";

# Additional dev-shell environment variables can be set directly
# MY_CUSTOM_DEVELOPMENT_VAR = "something else";
RENKU_CLI_RENKU_URL = "https://ci-renku-3668.dev.renku.ch";
Expand All @@ -167,6 +171,8 @@
# Extra inputs can be added here; cargo and rustc are provided by default.
packages = with pkgs; [
cargo-edit
fenixToolChain.rust-analyzer
fenixToolChain.rustfmt
];
};
});
Expand Down
1 change: 1 addition & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
edition = "2021"
10 changes: 5 additions & 5 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ pub mod cmd;
pub mod opts;
pub mod sink;

use self::cmd::{Cmd, CmdError, Context};
use self::cmd::{CmdError, Context};
use self::opts::{MainOpts, SubCommand};
use clap::CommandFactory;
use serde::Serialize;
use std::fmt;

pub fn execute_cmd(opts: MainOpts) -> Result<(), CmdError> {
pub async fn execute_cmd(opts: MainOpts) -> Result<(), CmdError> {
let ctx = Context::new(&opts.common_opts)?;

log::info!("Running command: {:?}", opts.subcmd);
match &opts.subcmd {
SubCommand::Version(input) => input.exec(&ctx)?,
SubCommand::Version(input) => input.exec(&ctx).await?,
SubCommand::ShellCompletion(input) => {
let mut app = MainOpts::command();
input.print_completions(&mut app);
input.print_completions(&mut app).await;
}
SubCommand::Project(input) => input.exec(&ctx)?,
SubCommand::Project(input) => input.exec(&ctx).await?,
};
Ok(())
}
Expand Down
Loading

0 comments on commit 2c612ae

Please sign in to comment.