[][src]Struct genco::lang::python::ImportModule

pub struct ImportModule { /* fields omitted */ }

The import of a Python module import module.

Created through the import_module() function.

Implementations

impl ImportModule[src]

pub fn with_alias<N>(self, new_alias: N) -> Self where
    N: Into<ItemStr>, 
[src]

Set alias for imported module.

Examples

use genco::prelude::*;

let toks = quote! {
    #(python::import_module("collections").with_alias("c"))
};

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

Trait Implementations

impl AsAny for ImportModule[src]

impl Clone for ImportModule[src]

impl Debug for ImportModule[src]

impl Eq for ImportModule[src]

impl FormatInto<Python> for ImportModule[src]

impl<'a> FormatInto<Python> for &'a ImportModule[src]

impl Hash for ImportModule[src]

impl LangItem<Python> for ImportModule[src]

impl Ord for ImportModule[src]

impl PartialEq<ImportModule> for ImportModule[src]

impl PartialOrd<ImportModule> for ImportModule[src]

impl Register<Python> for ImportModule[src]

impl<'a> Register<Python> for &'a ImportModule[src]

impl StructuralEq for ImportModule[src]

impl StructuralPartialEq for ImportModule[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.