aws_smithy_runtime_api/client/
connector_metadata.rs1use std::borrow::Cow;
9use std::fmt;
10
11#[derive(Clone, Debug, PartialEq, Eq)]
16pub struct ConnectorMetadata {
17    name: Cow<'static, str>,
18    version: Option<Cow<'static, str>>,
19}
20
21impl ConnectorMetadata {
22    pub fn new(name: impl Into<Cow<'static, str>>, version: Option<Cow<'static, str>>) -> Self {
24        Self {
25            name: name.into(),
26            version,
27        }
28    }
29
30    pub fn name(&self) -> Cow<'static, str> {
32        self.name.clone()
33    }
34
35    pub fn version(&self) -> Option<Cow<'static, str>> {
37        self.version.clone()
38    }
39}
40
41impl fmt::Display for ConnectorMetadata {
42    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
43        write!(f, "http#{}", self.name)?;
44        if let Some(version) = self.version.as_deref() {
45            write!(f, "-{}", version)?;
46        }
47
48        Ok(())
49    }
50}