pub struct ProtoFile {
pub package: String,
pub syntax: String,
pub imports: Vec<String>,
pub options: ProtoOptions,
pub enums: Vec<ProtoEnum>,
pub messages: Vec<ProtoMessage>,
pub services: Vec<ProtoService>,
pub metadata: ProtoMetadata,
}Expand description
Represents a complete .proto file.
Fields§
§package: StringThe package name (e.g., “sea.example”)
syntax: StringProtobuf syntax version (always “proto3”)
imports: Vec<String>Import statements
options: ProtoOptionsFile-level options
enums: Vec<ProtoEnum>Enum definitions
messages: Vec<ProtoMessage>Message definitions
services: Vec<ProtoService>gRPC service definitions
metadata: ProtoMetadataMetadata about the projection
Implementations§
Source§impl ProtoFile
impl ProtoFile
Sourcepub fn new(package: impl Into<String>) -> Self
pub fn new(package: impl Into<String>) -> Self
Create a new ProtoFile with the given package name.
Sourcepub fn to_proto_string(&self) -> String
pub fn to_proto_string(&self) -> String
Serialize the ProtoFile to .proto text format.
Sourcepub fn add_wkt_imports(&mut self)
pub fn add_wkt_imports(&mut self)
Scan all messages and automatically add required Well-Known Type imports.
This method should be called after all messages are added to ensure proper imports are included for any WKT fields.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ProtoFile
impl<'de> Deserialize<'de> for ProtoFile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ProtoFile
impl RefUnwindSafe for ProtoFile
impl Send for ProtoFile
impl Sync for ProtoFile
impl Unpin 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
Mutably borrows from an owned value. Read more