//! Address and TLS settings shared by backend configurations. use std::fmt; use serde::{Deserialize, Serialize}; #[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "snake_case")] pub enum Tls { #[default] VerifyFull, Disabled, } /// A backend connection string, endpoint URL, or local path. /// Debug output includes the full value, which may contain credentials. #[derive(Clone, Deserialize, Serialize)] #[serde(transparent)] pub struct Address(String); impl From<&str> for Address { fn from(value: &str) -> Self { Self(value.to_owned()) } } impl From for Address { fn from(value: String) -> Self { Self(value) } } impl fmt::Debug for Address { fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&self.0, formatter) } } impl Address { pub fn connection_string(&self) -> &str { &self.0 } }