Keep struct definitions and impl blocks together
This commit is contained in:
parent
cbd9fd84aa
commit
8839eb4a11
|
@ -57,6 +57,19 @@ pub struct EppClientTlsFiles {
|
||||||
pub key: String,
|
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
|
/// Connection details to connect to and authenticate with a registry
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub struct EppClientConnection {
|
pub struct EppClientConnection {
|
||||||
|
@ -68,12 +81,6 @@ pub struct EppClientConnection {
|
||||||
pub tls_files: Option<EppClientTlsFiles>,
|
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 {
|
impl EppClientConnection {
|
||||||
/// Returns the EPP host and port no as a tuple
|
/// Returns the EPP host and port no as a tuple
|
||||||
pub fn connection_details(&self) -> (String, u16) {
|
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()))
|
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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue