mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2024-12-22 18:33:30 +01:00
fix: add public tuple field and into func
This commit is contained in:
parent
f67928155f
commit
d7317e5cf3
@ -11,6 +11,12 @@ pub fn render_scalar(t: &FullType) -> eyre::Result<rust::Tokens> {
|
||||
|
||||
Ok(quote! {
|
||||
#[derive($serialize, $deserialize, PartialEq, Debug, Clone)]
|
||||
pub struct $(t.name.pipe(|n|format_name(n)))(String);
|
||||
pub struct $(t.name.pipe(|n|format_name(n)))(pub String);
|
||||
|
||||
impl Into<$(t.name.pipe(|n| format_name(n)))> for &str {
|
||||
fn into(self) -> $(t.name.pipe(|n| format_name(n))) {
|
||||
$(t.name.pipe(|n| format_name(n)))(self.to_string())
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
42
crates/dagger-sdk/examples/iss-30-alt/main.rs
Normal file
42
crates/dagger-sdk/examples/iss-30-alt/main.rs
Normal file
@ -0,0 +1,42 @@
|
||||
#![feature(async_closure)]
|
||||
|
||||
use dagger_sdk::{ContainerBuildOptsBuilder, HostDirectoryOpts, QueryContainerOpts};
|
||||
|
||||
static DOCKER_FILES: [&str; 3] = ["Dockerfile", "Dockerfile.alpine", "Dockerfile.distroless"];
|
||||
static PLATFORMS: [&str; 2] = ["linux/arm64", "linux/x86_64"];
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> eyre::Result<()> {
|
||||
let client = dagger_sdk::connect().await?;
|
||||
|
||||
let context = client.host().directory_opts(
|
||||
".",
|
||||
HostDirectoryOpts {
|
||||
exclude: Some(vec!["target", "client/node_modules", "client/build"]),
|
||||
include: None,
|
||||
},
|
||||
);
|
||||
|
||||
for file in DOCKER_FILES {
|
||||
for platform in PLATFORMS {
|
||||
let ref_ = client
|
||||
.container_opts(QueryContainerOpts {
|
||||
id: None,
|
||||
platform: Some(platform.into()),
|
||||
})
|
||||
.build_opts(
|
||||
context.id().await?,
|
||||
ContainerBuildOptsBuilder::default()
|
||||
.dockerfile(file)
|
||||
.build()
|
||||
.unwrap(),
|
||||
)
|
||||
.export("./test")
|
||||
.await?;
|
||||
|
||||
println!("published image to: {:#?}", ref_);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
@ -7,28 +7,70 @@ use std::sync::Arc;
|
||||
use tokio::process::Child;
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
pub struct CacheId(String);
|
||||
pub struct CacheId(pub String);
|
||||
|
||||
impl Into<CacheId> for &str {
|
||||
fn into(self) -> CacheId {
|
||||
CacheId(self.to_string())
|
||||
}
|
||||
}
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
pub struct ContainerId(String);
|
||||
pub struct ContainerId(pub String);
|
||||
|
||||
impl Into<ContainerId> for &str {
|
||||
fn into(self) -> ContainerId {
|
||||
ContainerId(self.to_string())
|
||||
}
|
||||
}
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
pub struct DirectoryId(String);
|
||||
pub struct DirectoryId(pub String);
|
||||
|
||||
impl Into<DirectoryId> for &str {
|
||||
fn into(self) -> DirectoryId {
|
||||
DirectoryId(self.to_string())
|
||||
}
|
||||
}
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
pub struct FileId(String);
|
||||
pub struct FileId(pub String);
|
||||
|
||||
impl Into<FileId> for &str {
|
||||
fn into(self) -> FileId {
|
||||
FileId(self.to_string())
|
||||
}
|
||||
}
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
pub struct Platform(String);
|
||||
pub struct Platform(pub String);
|
||||
|
||||
impl Into<Platform> for &str {
|
||||
fn into(self) -> Platform {
|
||||
Platform(self.to_string())
|
||||
}
|
||||
}
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
pub struct SecretId(String);
|
||||
pub struct SecretId(pub String);
|
||||
|
||||
impl Into<SecretId> for &str {
|
||||
fn into(self) -> SecretId {
|
||||
SecretId(self.to_string())
|
||||
}
|
||||
}
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
pub struct SocketId(String);
|
||||
pub struct SocketId(pub String);
|
||||
|
||||
impl Into<SocketId> for &str {
|
||||
fn into(self) -> SocketId {
|
||||
SocketId(self.to_string())
|
||||
}
|
||||
}
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
|
||||
pub struct BuildArg {
|
||||
pub value: String,
|
||||
pub name: String,
|
||||
pub value: String,
|
||||
}
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
|
||||
pub struct PipelineLabel {
|
||||
pub name: String,
|
||||
pub value: String,
|
||||
pub name: String,
|
||||
}
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CacheVolume {
|
||||
@ -2764,12 +2806,12 @@ impl Socket {
|
||||
}
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
|
||||
pub enum CacheSharingMode {
|
||||
SHARED,
|
||||
PRIVATE,
|
||||
LOCKED,
|
||||
SHARED,
|
||||
}
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
|
||||
pub enum NetworkProtocol {
|
||||
UDP,
|
||||
TCP,
|
||||
UDP,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user