use std::borrow::Cow;
#[derive(Debug)]
pub struct Interface<'i> {
host_if_name: Cow<'i, str>,
vm_if_name: Cow<'i, str>,
}
impl<'i> Interface<'i> {
pub fn new<H, V>(host_if_name: H, vm_if_name: V) -> Self
where
H: Into<Cow<'i, str>>,
V: Into<Cow<'i, str>>,
{
Interface {
host_if_name: host_if_name.into(),
vm_if_name: vm_if_name.into(),
}
}
pub fn host_if_name(&self) -> &str {
&self.host_if_name
}
pub fn vm_if_name(&self) -> &str {
&self.vm_if_name
}
}
#[cfg(test)]
mod tests {
#[test]
#[ignore]
fn string_generics() {
let _ = super::Interface::new("host_if_name", "vm_if_name");
let _ = super::Interface::new("host_if_name".to_string(), "vm_if_name");
}
}