WithStructFields

Trait WithStructFields 

Source
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§

Source

fn fields(&self) -> &[StructField]

Gets the struct fields.

Source

fn add_field<F>(&mut self, field: F)
where F: Into<StructField>,

Adds the struct field.

Provided Methods§

Source

fn with_field<F>(self, field: F) -> Self
where F: Into<StructField>,

Adds the struct field.

Source

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.

Implementors§