Impl Ref::fs_link_exists()

This commit is contained in:
Matthias Beyer 2016-06-23 14:14:39 +02:00
parent 130ea0db13
commit ac0d22e479

View file

@ -194,8 +194,8 @@ impl<'a> Ref<'a> {
} }
/// check whether the pointer the Ref represents still points to a file which exists /// check whether the pointer the Ref represents still points to a file which exists
pub fn fs_link_exists(&self) -> bool { pub fn fs_link_exists(&self) -> Result<bool> {
unimplemented!() self.fs_file().map(|pathbuf| pathbuf.exists())
} }
/// Alias for `r.fs_link_exists() && r.deref().is_file()` /// Alias for `r.fs_link_exists() && r.deref().is_file()`
@ -209,8 +209,8 @@ impl<'a> Ref<'a> {
} }
/// Alias for `!Ref::fs_link_exists()` /// Alias for `!Ref::fs_link_exists()`
pub fn is_dangling(&self) -> bool { pub fn is_dangling(&self) -> Result<bool> {
!self.fs_link_exists() self.fs_link_exists().map(|b| !b)
} }
/// check whether the pointer the Ref represents is valid /// check whether the pointer the Ref represents is valid