Keep struct definitions and impl blocks together

This commit is contained in:
Dirkjan Ochtman 2021-12-01 14:01:39 +01:00 committed by masalachai
parent cbd9fd84aa
commit 8839eb4a11
1 changed files with 13 additions and 13 deletions

View File

@ -57,6 +57,19 @@ pub struct EppClientTlsFiles {
pub key: String,
}
/// Config that stores settings for multiple registries
#[derive(Serialize, Deserialize, Debug)]
pub struct EppClientConfig {
pub registry: HashMap<String, EppClientConnection>,
}
impl EppClientConfig {
/// Returns the config for a particular registry
pub fn registry(&self, registry: &str) -> Option<&EppClientConnection> {
self.registry.get(registry)
}
}
/// Connection details to connect to and authenticate with a registry
#[derive(Serialize, Deserialize, Debug)]
pub struct EppClientConnection {
@ -68,12 +81,6 @@ pub struct EppClientConnection {
pub tls_files: Option<EppClientTlsFiles>,
}
/// Config that stores settings for multiple registries
#[derive(Serialize, Deserialize, Debug)]
pub struct EppClientConfig {
pub registry: HashMap<String, EppClientConnection>,
}
impl EppClientConnection {
/// Returns the EPP host and port no as a tuple
pub fn connection_details(&self) -> (String, u16) {
@ -136,10 +143,3 @@ impl EppClientConnection {
Err(Error::Other("No private key found in PEM file".to_owned()))
}
}
impl EppClientConfig {
/// Returns the config for a particular registry
pub fn registry(&self, registry: &str) -> Option<&EppClientConnection> {
self.registry.get(registry)
}
}