From 7e40e391fda87aea0fd0fb7882e293441d956d8a Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Sun, 4 Jun 2023 10:39:51 +0200 Subject: [PATCH] feat: display trait for DependencyCheckResult --- src/depcheck.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/depcheck.rs b/src/depcheck.rs index 8580417..0980fd8 100644 --- a/src/depcheck.rs +++ b/src/depcheck.rs @@ -1,4 +1,4 @@ -use std::{env, path::Path}; +use std::{env, fmt::Display, path::Path}; #[derive(Debug, Clone, PartialEq, Eq)] pub enum DepType { @@ -20,6 +20,19 @@ pub struct DependencyCheckResult { pub found: bool, } +impl Display for DependencyCheckResult { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_fmt(format_args!( + "{name} {result}", + name = self.dependency.name, + result = match self.found { + true => "Found", + false => "Not found", + } + )) + } +} + fn shared_obj_paths() -> Vec { vec![ "/lib".to_string(),