mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2025-07-25 19:09:22 +02:00
feat(sdk): move to &str instead of String and introduce builder.
This will make the api much easier to use, as we can now rely on "" instead of "".into() for normal string values. Introduced builder as well, which makes it much easier to use *Opts, as it can handle the building of that, and get the benefits from String -> &str, as that is currently not allowed for optional values
This commit is contained in:
@@ -1,19 +1,18 @@
|
||||
use dagger_sdk::{connect, ContainerExecOpts};
|
||||
use dagger_sdk::{connect, ContainerExecOptsBuilder};
|
||||
|
||||
#[test]
|
||||
fn test_example_container() {
|
||||
let client = connect().unwrap();
|
||||
|
||||
let alpine = client.container(None).from("alpine:3.16.2".into());
|
||||
let alpine = client.container(None).from("alpine:3.16.2");
|
||||
|
||||
let out = alpine
|
||||
.exec(Some(ContainerExecOpts {
|
||||
args: Some(vec!["cat".into(), "/etc/alpine-release".into()]),
|
||||
stdin: None,
|
||||
redirect_stdout: None,
|
||||
redirect_stderr: None,
|
||||
experimental_privileged_nesting: None,
|
||||
}))
|
||||
.exec(Some(
|
||||
ContainerExecOptsBuilder::default()
|
||||
.args(vec!["cat", "/etc/alpine-release"])
|
||||
.build()
|
||||
.unwrap(),
|
||||
))
|
||||
.stdout()
|
||||
.unwrap();
|
||||
|
||||
|
Reference in New Issue
Block a user