Struct trash::TrashContext
source · pub struct TrashContext { /* private fields */ }
Expand description
A collection of preferences for trash operations.
Implementations§
source§impl TrashContext
impl TrashContext
pub const fn new() -> Self
sourcepub fn delete<T: AsRef<Path>>(&self, path: T) -> Result<(), Error>
pub fn delete<T: AsRef<Path>>(&self, path: T) -> Result<(), Error>
Removes a single file or directory.
When a symbolic link is provided to this function, the symbolic link will be removed and the link target will be kept intact.
§Example
use std::fs::File;
use trash::delete;
File::create("delete_me").unwrap();
trash::delete("delete_me").unwrap();
assert!(File::open("delete_me").is_err());
sourcepub fn delete_all<I, T>(&self, paths: I) -> Result<(), Error>
pub fn delete_all<I, T>(&self, paths: I) -> Result<(), Error>
Removes all files/directories specified by the collection of paths provided as an argument.
When a symbolic link is provided to this function, the symbolic link will be removed and the link target will be kept intact.
§Example
use std::fs::File;
use trash::delete_all;
File::create("delete_me_1").unwrap();
File::create("delete_me_2").unwrap();
delete_all(&["delete_me_1", "delete_me_2"]).unwrap();
assert!(File::open("delete_me_1").is_err());
assert!(File::open("delete_me_2").is_err());
Trait Implementations§
source§impl Clone for TrashContext
impl Clone for TrashContext
source§fn clone(&self) -> TrashContext
fn clone(&self) -> TrashContext
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for TrashContext
impl Debug for TrashContext
source§impl Default for TrashContext
impl Default for TrashContext
source§fn default() -> TrashContext
fn default() -> TrashContext
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TrashContext
impl RefUnwindSafe for TrashContext
impl Send for TrashContext
impl Sync for TrashContext
impl Unpin for TrashContext
impl UnwindSafe for TrashContext
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more