Struct config_file_handler::ScopedUserAppDirRemover[][src]

pub struct ScopedUserAppDirRemover;

RAII object which removes the user_app_dir() when an instance is dropped.

Since the user_app_dir is frequently created by tests or examples which use Crust, this is a convenience object which tries to remove the directory when it is destroyed.

Examples

use config_file_handler::{FileHandler, ScopedUserAppDirRemover};

{
    let _cleaner = ScopedUserAppDirRemover;
    let file_handler = FileHandler::new("test.json", true).unwrap();
    // User app dir is possibly created by this call.
    let _ = file_handler.write_file(&111u64);
}
// User app dir is now removed since '_cleaner' has gone out of scope.

Trait Implementations

impl Drop for ScopedUserAppDirRemover
[src]

Executes the destructor for this type. Read more

Auto Trait Implementations