pub struct GenStruct<'a, P: Parent> { /* private fields */ }
Expand description
Builder to generate a struct <Name> { <field>: <ty>, ... }
Currently only structs with named fields are supported.
Implementations§
source§impl<'a, P: Parent> GenStruct<'a, P>
impl<'a, P: Parent> GenStruct<'a, P>
sourcepub fn make_pub(&mut self) -> &mut Self
pub fn make_pub(&mut self) -> &mut Self
Make the struct pub
. By default the struct will have no visibility modifier and will only be visible in the current scope.
sourcepub fn add_field(
&mut self,
name: impl Into<String>,
ty: impl Into<String>
) -> &mut Self
pub fn add_field( &mut self, name: impl Into<String>, ty: impl Into<String> ) -> &mut Self
Add a private field to the struct. For adding a public field, see add_pub_field
sourcepub fn add_pub_field(
&mut self,
name: impl Into<String>,
ty: impl Into<String>
) -> &mut Self
pub fn add_pub_field( &mut self, name: impl Into<String>, ty: impl Into<String> ) -> &mut Self
Add a public field to the struct. For adding a public field, see add_field
sourcepub fn impl_for(&mut self, name: impl Into<String>) -> ImplFor<'_, Self>
pub fn impl_for(&mut self, name: impl Into<String>) -> ImplFor<'_, Self>
Add an impl <name> for <struct>
sourcepub fn impl(&mut self) -> Impl<'_, Self>
pub fn impl(&mut self) -> Impl<'_, Self>
Generate an impl <name>
implementation. See Impl
for more information.
sourcepub fn generate_impl(&mut self) -> Impl<'_, Self>
pub fn generate_impl(&mut self) -> Impl<'_, Self>
Trait Implementations§
Auto Trait Implementations§
impl<'a, P> Freeze for GenStruct<'a, P>
impl<'a, P> RefUnwindSafe for GenStruct<'a, P>where
P: RefUnwindSafe,
impl<'a, P> !Send for GenStruct<'a, P>
impl<'a, P> !Sync for GenStruct<'a, P>
impl<'a, P> Unpin for GenStruct<'a, P>
impl<'a, P> !UnwindSafe for GenStruct<'a, P>
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