Skip to main content

normalize_languages/
textproto.rs

1//! Protocol Buffers text format support.
2
3use crate::{Language, LanguageSymbols};
4
5/// TextProto language support.
6pub struct TextProto;
7
8impl Language for TextProto {
9    fn name(&self) -> &'static str {
10        "TextProto"
11    }
12    fn extensions(&self) -> &'static [&'static str] {
13        &["textproto", "pbtxt"]
14    }
15    fn grammar_name(&self) -> &'static str {
16        "textproto"
17    }
18
19    fn as_symbols(&self) -> Option<&dyn LanguageSymbols> {
20        Some(self)
21    }
22}
23
24impl LanguageSymbols for TextProto {}
25
26#[cfg(test)]
27mod tests {
28    use super::*;
29    use crate::validate_unused_kinds_audit;
30
31    #[test]
32    fn unused_node_kinds_audit() {
33        #[rustfmt::skip]
34        let documented_unused: &[&str] = &[
35            "identifier", "type_name", "signed_identifier",
36        ];
37        validate_unused_kinds_audit(&TextProto, documented_unused)
38            .expect("TextProto unused node kinds audit failed");
39    }
40}