pub struct Struct { /* private fields */ }Expand description
Defines a struct.
Implementations§
Source§impl Struct
impl Struct
Sourcepub fn bound<T>(&mut self, name: impl ToString, ty: T) -> &mut Self
pub fn bound<T>(&mut self, name: impl ToString, ty: T) -> &mut Self
Add a where bound to the struct.
Sourcepub fn derive(&mut self, name: impl ToString) -> &mut Self
pub fn derive(&mut self, name: impl ToString) -> &mut Self
Add a new type that the struct should derive.
Sourcepub fn allow(&mut self, allow: impl ToString) -> &mut Self
pub fn allow(&mut self, allow: impl ToString) -> &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: impl ToString, ty: T) -> &mut Self
pub fn field<T>(&mut self, name: impl ToString, 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 new_field<T>(&mut self, name: impl ToString, ty: T) -> &mut Field
pub fn new_field<T>(&mut self, name: impl ToString, ty: T) -> &mut Field
Create a named field for 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