fix: add support for String as well

This commit is contained in:
Kasper Juul Hermansen 2023-03-13 20:33:24 +01:00 committed by Kasper Juul Hermansen
parent e9e35edb1c
commit c025d17424
4 changed files with 49 additions and 1 deletions

View File

@ -18,5 +18,11 @@ pub fn render_scalar(t: &FullType) -> eyre::Result<rust::Tokens> {
$(t.name.pipe(|n| format_name(n)))(self.to_string()) $(t.name.pipe(|n| format_name(n)))(self.to_string())
} }
} }
impl Into<$(t.name.pipe(|n| format_name(n)))> for String {
fn into(self) -> $(t.name.pipe(|n| format_name(n))) {
$(t.name.pipe(|n| format_name(n)))(self.clone())
}
}
}) })
} }

View File

@ -22,7 +22,7 @@ async fn main() -> eyre::Result<()> {
let ref_ = client let ref_ = client
.container_opts(QueryContainerOpts { .container_opts(QueryContainerOpts {
id: None, id: None,
platform: Some(platform.into()), platform: Some(platform.to_string().into()),
}) })
.build_opts( .build_opts(
context.id().await?, context.id().await?,

View File

@ -14,6 +14,12 @@ impl Into<CacheId> for &str {
CacheId(self.to_string()) CacheId(self.to_string())
} }
} }
impl Into<CacheId> for String {
fn into(self) -> CacheId {
CacheId(self.clone())
}
}
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
pub struct ContainerId(pub String); pub struct ContainerId(pub String);
@ -22,6 +28,12 @@ impl Into<ContainerId> for &str {
ContainerId(self.to_string()) ContainerId(self.to_string())
} }
} }
impl Into<ContainerId> for String {
fn into(self) -> ContainerId {
ContainerId(self.clone())
}
}
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
pub struct DirectoryId(pub String); pub struct DirectoryId(pub String);
@ -30,6 +42,12 @@ impl Into<DirectoryId> for &str {
DirectoryId(self.to_string()) DirectoryId(self.to_string())
} }
} }
impl Into<DirectoryId> for String {
fn into(self) -> DirectoryId {
DirectoryId(self.clone())
}
}
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
pub struct FileId(pub String); pub struct FileId(pub String);
@ -38,6 +56,12 @@ impl Into<FileId> for &str {
FileId(self.to_string()) FileId(self.to_string())
} }
} }
impl Into<FileId> for String {
fn into(self) -> FileId {
FileId(self.clone())
}
}
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
pub struct Platform(pub String); pub struct Platform(pub String);
@ -46,6 +70,12 @@ impl Into<Platform> for &str {
Platform(self.to_string()) Platform(self.to_string())
} }
} }
impl Into<Platform> for String {
fn into(self) -> Platform {
Platform(self.clone())
}
}
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
pub struct SecretId(pub String); pub struct SecretId(pub String);
@ -54,6 +84,12 @@ impl Into<SecretId> for &str {
SecretId(self.to_string()) SecretId(self.to_string())
} }
} }
impl Into<SecretId> for String {
fn into(self) -> SecretId {
SecretId(self.clone())
}
}
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
pub struct SocketId(pub String); pub struct SocketId(pub String);
@ -62,6 +98,12 @@ impl Into<SocketId> for &str {
SocketId(self.to_string()) SocketId(self.to_string())
} }
} }
impl Into<SocketId> for String {
fn into(self) -> SocketId {
SocketId(self.clone())
}
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct BuildArg { pub struct BuildArg {
pub name: String, pub name: String,