pub struct ProtoFile {
pub source: String,
pub package: String,
pub schema_id: String,
pub allow_list: Option<String>,
pub document_format: String,
pub messages: Vec<Message>,
pub enums: Vec<Enum>,
}Expand description
One parsed .proto document schema.
Fields§
§source: StringWhere it was read from, for diagnostics.
package: StringThe package declaration.
schema_id: Stringoption (majordomus.schema_id), the identity that fixes this file’s path.
allow_list: Option<String>option (majordomus.allow_list); absent means the kind projects no allow-list.
document_format: Stringoption (majordomus.document_format).
messages: Vec<Message>Every message, in declaration order.
enums: Vec<Enum>Every enum, in declaration order.
Implementations§
Source§impl ProtoFile
impl ProtoFile
Sourcepub fn enumeration(&self, name: &str) -> Option<&Enum>
pub fn enumeration(&self, name: &str) -> Option<&Enum>
The enum with this name.
Sourcepub fn header(&self) -> Result<&Message, Error>
pub fn header(&self) -> Result<&Message, Error>
The Header message, which every document schema must declare.
Sourcepub fn expected_path(schema_id: &str) -> Result<String, Error>
pub fn expected_path(schema_id: &str) -> Result<String, Error>
The path this file’s identity fixes, relative to the schema root:
majordomus.adr/v1 is majordomus/adr/adr.v1.proto. The identity and the path are
checked against each other on load, so neither can drift from the other.
Sourcepub fn identity_of(relative: &str) -> Option<String>
pub fn identity_of(relative: &str) -> Option<String>
The identity a path under the schema root carries, the inverse of
Self::expected_path. A path that does not have the shape yields nothing.
Trait Implementations§
impl Eq for ProtoFile
impl StructuralPartialEq for ProtoFile
Auto Trait Implementations§
impl Freeze for ProtoFile
impl RefUnwindSafe for ProtoFile
impl Send for ProtoFile
impl Sync for ProtoFile
impl Unpin for ProtoFile
impl UnsafeUnpin for ProtoFile
impl UnwindSafe for ProtoFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.