serde_rw 0.2.5

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 crate::Error;
use std::path::Path;

pub fn extension(path: &Path) -> Result<&str, Error> {
    path.extension()
        .and_then(std::ffi::OsStr::to_str)
        .ok_or(Error::InvalidExtension(None))
}