mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2025-08-03 06:13:26 +02:00
feat(sdk,core): Use async runtime instead of blocking.
Default to using async runtime instead of blocking. I.e. ```rust fn main() -> eyre::Result<()> { // ... client.container().from("rust").publish("somewhere")?; // ... } // to async fn main() -> eyre::Result<()> { // ... client.container().from("rust").publish("somewhere").await?; // ... } ```
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use rand::Rng;
|
||||
|
||||
fn main() -> eyre::Result<()> {
|
||||
#[tokio::main]
|
||||
async fn main() -> eyre::Result<()> {
|
||||
let mut rng = rand::thread_rng();
|
||||
|
||||
let client = dagger_sdk::connect()?;
|
||||
@@ -11,8 +12,8 @@ fn main() -> eyre::Result<()> {
|
||||
|
||||
let ref_ = client
|
||||
.container()
|
||||
.build(context_dir.id()?)
|
||||
.publish(format!("ttl.sh/hello-dagger-rs-{}:1h", rng.gen::<u64>()))?;
|
||||
.build(context_dir.id().await?)
|
||||
.publish(format!("ttl.sh/hello-dagger-rs-{}:1h", rng.gen::<u64>())).await?;
|
||||
|
||||
println!("published image to: {}", ref_);
|
||||
|
||||
|
Reference in New Issue
Block a user