pub struct Struct { /* private fields */ }
Expand description
Defines a struct.
Implementations§
Source§impl Struct
impl Struct
Sourcepub fn derive(&mut self, name: &str) -> &mut Self
pub fn derive(&mut self, name: &str) -> &mut Self
Add a new type that the struct should derive.
Sourcepub fn allow(&mut self, allow: &str) -> &mut Self
pub fn allow(&mut self, allow: &str) -> &mut Self
Specify lint attribute to supress a warning or error.
Sourcepub fn push_field(&mut self, field: Field) -> &mut Self
pub fn push_field(&mut self, field: Field) -> &mut Self
Push a named field to the struct.
A struct can either set named fields with this function or tuple fields
with push_tuple_field
, but not both.
Sourcepub fn field<T>(&mut self, name: &str, ty: T) -> &mut Self
pub fn field<T>(&mut self, name: &str, ty: T) -> &mut Self
Add a named field to the struct.
A struct can either set named fields with this function or tuple fields
with tuple_field
, but not both.
Sourcepub fn tuple_field<T>(&mut self, ty: T) -> &mut Self
pub fn tuple_field<T>(&mut self, ty: T) -> &mut Self
Add a tuple field to the struct.
A struct can either set tuple fields with this function or named fields
with field
, but not both.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Struct
impl RefUnwindSafe for Struct
impl Send for Struct
impl Sync for Struct
impl Unpin for Struct
impl UnwindSafe for Struct
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