fix: add support for String as well

This commit is contained in:
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

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