pub trait WithStructFields: Sized {
// Required methods
fn fields(&self) -> &[StructField];
fn add_field<F>(&mut self, field: F)
where F: Into<StructField>;
// Provided methods
fn with_field<F>(self, field: F) -> Self
where F: Into<StructField> { ... }
fn write_fields(&self, b: &mut CodeBuffer, level: usize) { ... }
}Expand description
An element with struct fields.
Required Methods§
Sourcefn fields(&self) -> &[StructField]
fn fields(&self) -> &[StructField]
Gets the struct fields.
Sourcefn add_field<F>(&mut self, field: F)where
F: Into<StructField>,
fn add_field<F>(&mut self, field: F)where
F: Into<StructField>,
Adds the struct field.
Provided Methods§
Sourcefn with_field<F>(self, field: F) -> Selfwhere
F: Into<StructField>,
fn with_field<F>(self, field: F) -> Selfwhere
F: Into<StructField>,
Adds the struct field.
Sourcefn write_fields(&self, b: &mut CodeBuffer, level: usize)
fn write_fields(&self, b: &mut CodeBuffer, level: usize)
Writes the struct fields.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.