pub struct Struct { /* private fields */ }
Expand description
Defines a struct.
Implementations
sourceimpl Struct
impl Struct
sourcepub fn bound<T>(&mut self, name: &str, ty: T) -> &mut Selfwhere
T: Into<Type>,
pub fn bound<T>(&mut self, name: &str, ty: T) -> &mut Selfwhere
T: Into<Type>,
Add a where
bound to the 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 Selfwhere
T: Into<Type>,
pub fn field<T>(&mut self, name: &str, ty: T) -> &mut Selfwhere
T: Into<Type>,
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 Into<String>, ty: T) -> &mut Fieldwhere
T: Into<Type>,
pub fn new_field<T>(&mut self, name: impl Into<String>, ty: T) -> &mut Fieldwhere
T: Into<Type>,
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 Selfwhere
T: Into<Type>,
pub fn tuple_field<T>(&mut self, ty: T) -> &mut Selfwhere
T: Into<Type>,
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 RefUnwindSafe for Struct
impl Send for Struct
impl Sync for Struct
impl Unpin for Struct
impl UnwindSafe for Struct
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more