[][src]Macro born::public_struct

macro_rules! public_struct {
    (pub struct $commonstruct:ident { $( $commonfieldpub:vis $commonfield:ident: $commonty:ty ),+ $(,)* }) => { ... };
}

Similar to private_struct! but public.

Example

public_struct!(
    // pub is required before 'struct' when you use public_struct!
    pub struct MessageBase {
        pub text: String
        // text: String // pub is optional in fields.
    }
); // 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);