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

pub fn imported<M, N>(module: M, name: N) -> Type where
    M: Into<ItemStr>,
    N: Into<ItemStr>, 

Setup an imported element.

Examples

use genco::prelude::*;

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

let toks = quote! {
    #ty
};

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