From ac0d22e4799d4f0baa43b833f02b16b3e58ee1b8 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 23 Jun 2016 14:14:39 +0200 Subject: [PATCH] Impl Ref::fs_link_exists() --- libimagref/src/reference.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libimagref/src/reference.rs b/libimagref/src/reference.rs index 084464b8..1301d19a 100644 --- a/libimagref/src/reference.rs +++ b/libimagref/src/reference.rs @@ -194,8 +194,8 @@ impl<'a> Ref<'a> { } /// check whether the pointer the Ref represents still points to a file which exists - pub fn fs_link_exists(&self) -> bool { - unimplemented!() + pub fn fs_link_exists(&self) -> Result { + self.fs_file().map(|pathbuf| pathbuf.exists()) } /// Alias for `r.fs_link_exists() && r.deref().is_file()` @@ -209,8 +209,8 @@ impl<'a> Ref<'a> { } /// Alias for `!Ref::fs_link_exists()` - pub fn is_dangling(&self) -> bool { - !self.fs_link_exists() + pub fn is_dangling(&self) -> Result { + self.fs_link_exists().map(|b| !b) } /// check whether the pointer the Ref represents is valid