pub struct PyMethodDef {
pub name: &'static str,
pub func: &'static dyn PyNativeFn,
pub flags: PyMethodFlags,
pub doc: Option<&'static str>,
}
Fields§
§name: &'static str
§func: &'static dyn PyNativeFn
§flags: PyMethodFlags
§doc: Option<&'static str>
Implementations§
Source§impl PyMethodDef
impl PyMethodDef
pub const fn new_const<Kind>( name: &'static str, func: impl IntoPyNativeFn<Kind>, flags: PyMethodFlags, doc: Option<&'static str>, ) -> Self
pub const fn new_raw_const( name: &'static str, func: impl PyNativeFn, flags: PyMethodFlags, doc: Option<&'static str>, ) -> Self
pub fn to_proper_method( &'static self, class: &'static Py<PyType>, ctx: &Context, ) -> PyObjectRef
pub fn to_function(&'static self) -> PyNativeFunction
pub fn to_method( &'static self, class: &'static Py<PyType>, ctx: &Context, ) -> PyMethodDescriptor
pub fn to_bound_method( &'static self, obj: PyObjectRef, class: &'static Py<PyType>, ) -> PyNativeMethod
pub fn build_function(&'static self, ctx: &Context) -> PyRef<PyNativeFunction>
pub fn build_bound_function( &'static self, ctx: &Context, obj: PyObjectRef, ) -> PyRef<PyNativeFunction>
pub fn build_method( &'static self, ctx: &Context, class: &'static Py<PyType>, ) -> PyRef<PyMethodDescriptor>
pub fn build_bound_method( &'static self, ctx: &Context, obj: PyObjectRef, class: &'static Py<PyType>, ) -> PyRef<PyNativeMethod>
pub fn build_classmethod( &'static self, ctx: &Context, class: &'static Py<PyType>, ) -> PyRef<PyMethodDescriptor>
pub fn build_staticmethod( &'static self, ctx: &Context, class: &'static Py<PyType>, ) -> PyRef<PyNativeMethod>
Trait Implementations§
Source§impl Clone for PyMethodDef
impl Clone for PyMethodDef
Source§fn clone(&self) -> PyMethodDef
fn clone(&self) -> PyMethodDef
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 moreAuto Trait Implementations§
impl Freeze for PyMethodDef
impl !RefUnwindSafe for PyMethodDef
impl !Send for PyMethodDef
impl !Sync for PyMethodDef
impl Unpin for PyMethodDef
impl !UnwindSafe for PyMethodDef
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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