pub struct ImportModule { /* private fields */ }
Expand description
The import of a Python module import module
.
Created through the import_module() function.
Implementations§
Source§impl ImportModule
impl ImportModule
Sourcepub fn with_alias<N>(self, new_alias: N) -> Self
pub fn with_alias<N>(self, new_alias: N) -> Self
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§
Source§impl Clone for ImportModule
impl Clone for ImportModule
Source§fn clone(&self) -> ImportModule
fn clone(&self) -> ImportModule
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ImportModule
impl Debug for ImportModule
Source§impl<'a> FormatInto<Python> for &'a ImportModule
impl<'a> FormatInto<Python> for &'a ImportModule
Source§impl FormatInto<Python> for ImportModule
impl FormatInto<Python> for ImportModule
Source§impl From<ImportModule> for Any
impl From<ImportModule> for Any
Source§fn from(lang: ImportModule) -> Self
fn from(lang: ImportModule) -> Self
Converts to this type from the input type.
Source§impl Hash for ImportModule
impl Hash for ImportModule
Source§impl LangItem<Python> for ImportModule
impl LangItem<Python> for ImportModule
Source§impl Ord for ImportModule
impl Ord for ImportModule
Source§fn cmp(&self, other: &ImportModule) -> Ordering
fn cmp(&self, other: &ImportModule) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for ImportModule
impl PartialEq for ImportModule
Source§impl PartialOrd for ImportModule
impl PartialOrd for ImportModule
Source§impl<'a> Register<Python> for &'a ImportModule
impl<'a> Register<Python> for &'a ImportModule
Source§impl Register<Python> for ImportModule
impl Register<Python> for ImportModule
impl Eq for ImportModule
impl StructuralPartialEq for ImportModule
Auto Trait Implementations§
impl Freeze for ImportModule
impl RefUnwindSafe for ImportModule
impl Send for ImportModule
impl Sync for ImportModule
impl Unpin for ImportModule
impl UnwindSafe for ImportModule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more