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

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

Setup an imported element.

Examples

use genco::prelude::*;

let toks = quote! {
    #(python::imported("collections").name("named_tuple"))
    #(python::imported("collections"))
    #(python::imported("collections").alias("c").name("named_tuple"))
    #(python::imported("collections").alias("c"))
};

assert_eq!(
    vec![
        "import collections",
        "import collections as c",
        "",
        "collections.named_tuple",
        "collections",
        "c.named_tuple",
        "c",
    ],
    toks.to_file_vec().unwrap()
);