[][src]Function genco::prelude::go::map

pub fn map<K, V>(key: K, value: V) -> Map where
    K: Into<TypeBox>,
    V: Into<TypeBox>, 

Setup a map.

Examples

use genco::prelude::*;

let ty = go::map(go::imported("foo", "Debug"), go::INTERFACE);

let toks = quote! {
    #ty
};

assert_eq!(
    vec![
        "package foo",
        "",
        "import \"foo\"",
        "",
        "map[foo.Debug]interface{}",
    ],
    toks.to_file_vec_with(
        go::Config::default().with_package("foo"),
        FormatterConfig::from_lang::<Go>()
    )
    .unwrap()
);