pub fn try_from<P: Into<PathBuf>>(p: P) -> Result<Self, FlexiLoggerError> {
        let p: PathBuf = p.into();
        if p.is_dir() {
            Err(FlexiLoggerError::OutputBadFile)
        } else {
            Ok(FileSpec {
                directory: p.parent().unwrap(/*cannot fail*/).to_path_buf(),
                basename: p.file_stem().unwrap(/*ok*/).to_string_lossy().to_string(),
                o_discriminant: None,
                o_suffix: p.extension().map(|s| s.to_string_lossy().to_string()),
                timestamp_cfg: TimestampCfg::No,
            })
        }
    }
/// The provided path should describe a log file.
/// If it exists, it must be a file, not a folder.
/// If necessary, parent folders will be created.
///
/// # Errors
///
/// [`FlexiLoggerError::OutputBadFile`] if the given path exists and is a folder.
///
/// # Panics
///
/// Panics if the basename of the given path has no filename
The provided path should describe a log file.
If it exists, it must be a file, not a folder.
If necessary, parent folders will be created.
The provided path should describe a log file . If it exists it must be a file not a folder . If necessary parent folders will be created .
pub fn try_from<P: Into<PathBuf>>(p: P) -> Result<Self, FlexiLoggerError> {
        let p: PathBuf = p.into();
        if p.is_dir() {
            Err(FlexiLoggerError::OutputBadFile)
        } else {
            Ok(FileSpec {
                directory: p.parent().unwrap(/*cannot fail*/).to_path_buf(),
                basename: p.file_stem().unwrap(/*ok*/).to_string_lossy().to_string(),
                o_discriminant: None,
                o_suffix: p.extension().map(|s| s.to_string_lossy().to_string()),
                timestamp_cfg: TimestampCfg::No,
            })
        }
    }
pub fn try_from < P : Into < PathBuf > > ( p : P ) -> Result < Self , FlexiLoggerError > { let p : PathBuf = p . into ( ) ; if p . is_dir ( ) { Err ( FlexiLoggerError :: OutputBadFile ) } else { Ok ( FileSpec { directory : p . parent ( ) . unwrap ( /*cannot fail*/ ) . to_path_buf ( ) , basename : p . file_stem ( ) . unwrap ( /*ok*/ ) . to_string_lossy ( ) . to_string ( ) , o_discriminant : None , o_suffix : p . extension ( ) . map ( | s | s . to_string_lossy ( ) . to_string ( ) ) , timestamp_cfg : TimestampCfg :: No , } ) } }
The provided path should describe a log file.
The provided path should describe a log file .
p
P
errors
[`FlexiLoggerError::OutputBadFile`] if the given path exists and is a folder.
[ ` FlexiLoggerError :: OutputBadFile ` ] if the given path exists and is a folder .
panics
Panics if the basename of the given path has no filename
Panics if the basename of the given path has no filename