pub struct ImportModule { /* private fields */ }
Expand description
The import of a Python module import module
.
Created through the import_module() function.
Implementations
sourceimpl ImportModule
impl ImportModule
sourcepub fn with_alias<N>(self, new_alias: N) -> Selfwhere
N: Into<ItemStr>,
pub fn with_alias<N>(self, new_alias: N) -> Selfwhere
N: Into<ItemStr>,
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
sourceimpl Clone for ImportModule
impl Clone for ImportModule
sourcefn clone(&self) -> ImportModule
fn clone(&self) -> ImportModule
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ImportModule
impl Debug for ImportModule
sourceimpl<'a> FormatInto<Python> for &'a ImportModule
impl<'a> FormatInto<Python> for &'a ImportModule
sourcefn format_into(self, tokens: &mut Tokens<Python>)
fn format_into(self, tokens: &mut Tokens<Python>)
Convert the type into tokens in-place. Read more
sourceimpl FormatInto<Python> for ImportModule
impl FormatInto<Python> for ImportModule
sourcefn format_into(self, tokens: &mut Tokens<Python>)
fn format_into(self, tokens: &mut Tokens<Python>)
Convert the type into tokens in-place. Read more
sourceimpl From<ImportModule> for Any
impl From<ImportModule> for Any
sourcefn from(lang: ImportModule) -> Self
fn from(lang: ImportModule) -> Self
Converts to this type from the input type.
sourceimpl Hash for ImportModule
impl Hash for ImportModule
sourceimpl LangItem<Python> for ImportModule
impl LangItem<Python> for ImportModule
sourceimpl Ord for ImportModule
impl Ord for ImportModule
sourcefn cmp(&self, other: &ImportModule) -> Ordering
fn cmp(&self, other: &ImportModule) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialEq<ImportModule> for ImportModule
impl PartialEq<ImportModule> for ImportModule
sourcefn eq(&self, other: &ImportModule) -> bool
fn eq(&self, other: &ImportModule) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourceimpl PartialOrd<ImportModule> for ImportModule
impl PartialOrd<ImportModule> for ImportModule
sourcefn partial_cmp(&self, other: &ImportModule) -> Option<Ordering>
fn partial_cmp(&self, other: &ImportModule) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<'a> Register<Python> for &'a ImportModule
impl<'a> Register<Python> for &'a ImportModule
sourceimpl Register<Python> for ImportModule
impl Register<Python> for ImportModule
impl Eq for ImportModule
impl StructuralEq for ImportModule
impl StructuralPartialEq for ImportModule
Auto Trait Implementations
impl RefUnwindSafe for ImportModule
impl Send for ImportModule
impl Sync for ImportModule
impl Unpin for ImportModule
impl UnwindSafe for ImportModule
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more