use serde::{Deserialize, Serialize};
use std::borrow::Borrow;
use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct IngressKey(pub String);
impl IngressKey {
pub fn as_str(&self) -> &str {
&self.0
}
}
impl From<String> for IngressKey {
fn from(value: String) -> Self {
Self(value)
}
}
impl From<&str> for IngressKey {
fn from(value: &str) -> Self {
Self(value.to_string())
}
}
impl AsRef<str> for IngressKey {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl Borrow<str> for IngressKey {
fn borrow(&self) -> &str {
self.as_str()
}
}
impl fmt::Display for IngressKey {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}
impl PartialEq<&str> for IngressKey {
fn eq(&self, other: &&str) -> bool {
self.as_str() == *other
}
}
impl PartialEq<IngressKey> for &str {
fn eq(&self, other: &IngressKey) -> bool {
*self == other.as_str()
}
}