Skip to main content

private_struct

Macro private_struct 

Source
macro_rules! private_struct {
    (struct $commonstruct:ident { $( $commonfield:ident: $commonty:ty ),+ $(,)* }) => { ... };
}
Expand description

Use it to to create, extend and reuse fields from private struct definition.

ยงExample

private_struct!(
    struct MessageBase {
        text: String
    }
); // It is lazy. Nothing is made yet.

MessageBase!(); // You have to call it to use the struct.
let message = MessageBase {
    text: "First Message".into(),
};
println!("{}", &message.text);