mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2025-07-26 03:19:21 +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:
File diff suppressed because it is too large
Load Diff
@@ -93,18 +93,13 @@ impl Selection {
|
||||
Ok(fields.join("{") + &"}".repeat(fields.len() - 1))
|
||||
}
|
||||
|
||||
pub fn execute<D>(&self, gql_client: &gql_client::Client) -> eyre::Result<D>
|
||||
pub async fn execute<D>(&self, gql_client: &gql_client::Client) -> eyre::Result<D>
|
||||
where
|
||||
D: for<'de> Deserialize<'de>,
|
||||
{
|
||||
let query = self.build()?;
|
||||
|
||||
let basic = tokio::runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
let resp: Option<serde_json::Value> = match basic.block_on(gql_client.query(&query)) {
|
||||
let resp: Option<serde_json::Value> = match gql_client.query(&query).await {
|
||||
Ok(r) => r,
|
||||
Err(e) => eyre::bail!(e),
|
||||
};
|
||||
|
Reference in New Issue
Block a user