aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/package
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/package')
-rw-r--r--crates/shirabe/src/package/link.rs21
1 files changed, 12 insertions, 9 deletions
diff --git a/crates/shirabe/src/package/link.rs b/crates/shirabe/src/package/link.rs
index 946c664..0157989 100644
--- a/crates/shirabe/src/package/link.rs
+++ b/crates/shirabe/src/package/link.rs
@@ -76,23 +76,26 @@ impl Link {
&self.pretty_constraint
}
- pub fn to_string(&self) -> String {
+ pub fn get_pretty_string(&self, source_package: PackageInterfaceHandle) -> String {
format!(
- "{} {} {} ({})",
- self.source,
+ "{} {} {} {}",
+ source_package.get_pretty_string(),
self.description,
self.target,
- self.constraint.to_string(),
+ self.constraint.get_pretty_string()
)
}
+}
- pub fn get_pretty_string(&self, source_package: PackageInterfaceHandle) -> String {
- format!(
- "{} {} {} {}",
- source_package.get_pretty_string(),
+impl std::fmt::Display for Link {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(
+ f,
+ "{} {} {} ({})",
+ self.source,
self.description,
self.target,
- self.constraint.get_pretty_string()
+ self.constraint.to_string(),
)
}
}