Skip to main content

go_struct

Macro go_struct 

Source
macro_rules! go_struct {
    (
        $(#[$meta:meta])*
        pub struct $name:ident ($go_type:literal) {
            $( $(#[$fmeta:meta])* $wire:literal $($omit:ident)? => $field:ident : $ty:ty ),* $(,)?
        }
    ) => { ... };
    (@omit omitempty) => { ... };
    (@omit) => { ... };
}
Expand description

Declares a Go struct with its wire names. Append omitempty after a name for Go’s ,omitempty.

ⓘ
go_struct! {
    pub struct PayloadResponse("pluginapi.PayloadResponse") {
        "Body" => body: Bytes,
        "path" omitempty => path: String,
    }
}