reproto_core/rp_package_format.rs
1//! Helper structure to format package information.
2
3use super::{RpPackage, Version};
4use std::fmt;
5
6/// Helper structure to format package information.
7pub struct RpPackageFormat<'a>(pub &'a RpPackage, pub Option<&'a Version>);
8
9impl<'a> fmt::Display for RpPackageFormat<'a> {
10 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
11 write!(f, "{}", self.0)?;
12
13 if let Some(version) = self.1 {
14 write!(f, "-{}", version)?;
15 }
16
17 Ok(())
18 }
19}