protobuf-parse 3.0.0-alpha.14

Parse `.proto` files. Files are parsed into a `protobuf::descriptor::FileDescriptorSet` object using either: * pure rust parser (no dependencies) * `protoc` binary (more reliable and compatible with Google's implementation)
Documentation
use std::path::is_separator;

use crate::proto_path::ProtoPath;

pub(crate) fn fs_path_to_proto_path(path: &ProtoPath) -> String {
    path.to_str()
        .chars()
        .map(|c| if is_separator(c) { '/' } else { c })
        .collect()
}

#[cfg(test)]
mod test {
    use crate::path::fs_path_to_proto_path;
    use crate::ProtoPath;

    #[test]
    fn test_fs_path_to_proto_path() {
        assert_eq!(
            "foo.proto",
            fs_path_to_proto_path(ProtoPath::new("foo.proto").unwrap())
        );
        assert_eq!(
            "bar/foo.proto",
            fs_path_to_proto_path(ProtoPath::new("bar/foo.proto").unwrap())
        );
    }
}