fn append_logfile_nonessential(
    path: Option<impl AsRef<Path>>,
    cont: impl FnOnce(::std::fs::File),
) {
    if let Some(path) = path {
        let log = {
            std::fs::OpenOptions::new()
                .write(true)
                .create(true)
                .append(true)
                .open(path)
        };
        if let Ok(file) = log {
            cont(file)
        }
    }
}
/// Tries to temporarily open the logfile to append something non-essential
/// (like a divider or placeholder). IO errors are silently ignored.
Tries to temporarily open the logfile to append something non-essential
(like a divider or placeholder). IO errors are silently ignored.
Tries to temporarily open the logfile to append something non - essential ( like a divider or placeholder ) . IO errors are silently ignored .
fn append_logfile_nonessential(
    path: Option<impl AsRef<Path>>,
    cont: impl FnOnce(::std::fs::File),
) {
    if let Some(path) = path {
        let log = {
            std::fs::OpenOptions::new()
                .write(true)
                .create(true)
                .append(true)
                .open(path)
        };
        if let Ok(file) = log {
            cont(file)
        }
    }
}
fn append_logfile_nonessential ( path : Option < impl AsRef < Path > > , cont : impl FnOnce ( :: std :: fs :: File ) , ) { if let Some ( path ) = path { let log = { std :: fs :: OpenOptions :: new ( ) . write ( true ) . create ( true ) . append ( true ) . open ( path ) } ; if let Ok ( file ) = log { cont ( file ) } } }
Tries to temporarily open the logfile to append something non-essential
(like a divider or placeholder).
Tries to temporarily open the logfile to append something non - essential ( like a divider or placeholder ) .
path
Option<impl AsRef<Path>>
cont
impl FnOnce(::std::fs::File)
path
Option<impl AsRef<Path>>
cont
impl FnOnce(::std::fs::File)