1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#![warn(missing_docs)]
#![doc = include_str!("../README.md")]
use std::path::PathBuf;
pub fn include_dir() -> &'static str {
let out_dir = concat!(env!("CARGO_MANIFEST_DIR"), "/src/protos");
out_dir
}
pub fn protos() -> Vec<PathBuf> {
let pattern = concat!(env!("CARGO_MANIFEST_DIR"), "/src/protos/*.proto");
let mut paths: Vec<PathBuf> = glob::glob(pattern).unwrap().map(|p| p.unwrap()).collect();
paths.sort();
paths
}
#[cfg(test)]
mod tests {
use crate::protos;
#[test]
fn has_protos() {
assert!(protos().len() > 0)
}
#[test]
fn protos_exist() {
for proto in protos() {
assert!(proto.exists());
}
}
}