Struct virtue::generate::GenerateMod
source · pub struct GenerateMod<'a, P: Parent> { /* private fields */ }
Expand description
Builder for generating a module with its contents.
Implementations§
source§impl<'a, P: Parent> GenerateMod<'a, P>
impl<'a, P: Parent> GenerateMod<'a, P>
sourcepub fn add_use(&mut self, use: impl AsRef<str>) -> Result
pub fn add_use(&mut self, use: impl AsRef<str>) -> Result
Add a use ...;
to the current mod
generator.impl_mod("foo").add_use("bar")
will generate:
ⓘ
mod foo {
use bar;
}
This is especially useful with .add_use("super::*");
, which will pull all parent imports into scope
sourcepub fn generate_struct(
&mut self,
name: impl Into<String>
) -> GenStruct<'_, Self>
pub fn generate_struct( &mut self, name: impl Into<String> ) -> GenStruct<'_, Self>
Generate a struct with the given name.
Trait Implementations§
source§impl<'a, P: Parent> Drop for GenerateMod<'a, P>
impl<'a, P: Parent> Drop for GenerateMod<'a, P>
Auto Trait Implementations§
impl<'a, P> Freeze for GenerateMod<'a, P>
impl<'a, P> RefUnwindSafe for GenerateMod<'a, P>where
P: RefUnwindSafe,
impl<'a, P> !Send for GenerateMod<'a, P>
impl<'a, P> !Sync for GenerateMod<'a, P>
impl<'a, P> Unpin for GenerateMod<'a, P>
impl<'a, P> !UnwindSafe for GenerateMod<'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