pub struct ModuleDef {
ffi_def: UnsafeCell<PyModuleDef>,
initializer: ModuleInitializer,
module: GILOnceCell<Py<PyModule>>,
gil_used: AtomicBool,
}
Expand description
Sync
wrapper of ffi::PyModuleDef
.
Fields§
§ffi_def: UnsafeCell<PyModuleDef>
§initializer: ModuleInitializer
§module: GILOnceCell<Py<PyModule>>
Initialized module object, cached to avoid reinitialization.
gil_used: AtomicBool
Whether or not the module supports running without the GIL
Implementations§
Source§impl ModuleDef
impl ModuleDef
Sourcepub const unsafe fn new(
name: &'static CStr,
doc: &'static CStr,
initializer: ModuleInitializer,
) -> Self
pub const unsafe fn new( name: &'static CStr, doc: &'static CStr, initializer: ModuleInitializer, ) -> Self
Make new module definition with given module name.
Sourcepub fn make_module(
&'static self,
py: Python<'_>,
gil_used: bool,
) -> PyResult<Py<PyModule>>
pub fn make_module( &'static self, py: Python<'_>, gil_used: bool, ) -> PyResult<Py<PyModule>>
Builds a module using user given initializer. Used for #[pymodule]
.
Trait Implementations§
Source§impl PyAddToModule for ModuleDef
impl PyAddToModule for ModuleDef
For adding a module to a module.
impl Sealed for ModuleDef
impl Sync for ModuleDef
Auto Trait Implementations§
impl !Freeze for ModuleDef
impl !RefUnwindSafe for ModuleDef
impl !Send for ModuleDef
impl Unpin for ModuleDef
impl UnwindSafe for ModuleDef
Blanket Implementations§
Source§impl<T> AssertNotZeroSized for T
impl<T> AssertNotZeroSized for T
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more