Struct binary_util::Struct
source · pub struct Struct { /* private fields */ }
Expand description
Defines a struct.
Implementations§
source§impl Struct
impl Struct
sourcepub fn bound<T>(&mut self, name: &str, ty: T) -> &mut Structwhere
T: Into<Type>,
pub fn bound<T>(&mut self, name: &str, ty: T) -> &mut Structwhere T: Into<Type>,
Add a where
bound to the struct.
sourcepub fn derive(&mut self, name: &str) -> &mut Struct
pub fn derive(&mut self, name: &str) -> &mut Struct
Add a new type that the struct should derive.
sourcepub fn allow(&mut self, allow: &str) -> &mut Struct
pub fn allow(&mut self, allow: &str) -> &mut Struct
Specify lint attribute to supress a warning or error.
sourcepub fn push_field(&mut self, field: Field) -> &mut Struct
pub fn push_field(&mut self, field: Field) -> &mut Struct
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 Structwhere
T: Into<Type>,
pub fn field<T>(&mut self, name: &str, ty: T) -> &mut Structwhere 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 tuple_field<T>(&mut self, ty: T) -> &mut Structwhere
T: Into<Type>,
pub fn tuple_field<T>(&mut self, ty: T) -> &mut Structwhere 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§
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