serde_rw 0.4.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
use std::path::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"))
}