serde_rw 0.5.1

Extend serde serializers and deserializers with the ability to read / write different file formats from / to files
Documentation
1
2
3
4
5
6
7
8
use std::path::Path;

/// Extract the file extension from a path.
pub fn extension(path: &Path) -> anyhow::Result<&str> {
    path.extension()
        .and_then(std::ffi::OsStr::to_str)
        .ok_or_else(|| anyhow::Error::msg("missing extension"))
}