Skip to main content

GeneratedFile

Struct GeneratedFile 

Source
pub struct GeneratedFile {
    pub name: String,
    pub package: String,
    pub kind: GeneratedFileKind,
    pub content: String,
}
Expand description

One generated output file.

Each .proto produces five content files (<stem>.rs, <stem>.__view.rs, <stem>.__oneof.rs, <stem>.__view_oneof.rs, <stem>.__ext.rs) and each proto package produces one <dotted.pkg>.mod.rs stitcher that include!s the content files and authors the pub mod __buffa { … } ancillary tree. See DESIGN.md → “Generated code layout”.

Consumers normally only need to wire up the GeneratedFileKind::PackageMod entries (one per package); the five per-proto content kinds are reached transitively via include! from the stitcher. Write all files to disk; build a module tree from only the PackageMod ones.

With CodeGenConfig::file_per_package set, the per-proto content kinds are not emitted at all — the single <dotted.pkg>.rs (still kind PackageMod) inlines what the stitcher would include!.

Fields§

§name: String

The output file path (e.g., "my.pkg.foo.rs" or "my.pkg.mod.rs").

§package: String

The proto package this file belongs to.

§kind: GeneratedFileKind

What this file contains. Build integrations only need to wire up GeneratedFileKind::PackageMod files; everything else is reached via include! from there.

§content: String

The generated Rust source code.

Trait Implementations§

Source§

impl Debug for GeneratedFile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.