pub struct PyMethodDef {
pub name: &'static str,
pub func: &'static dyn PyNativeFn,
pub flags: PyMethodFlags,
pub doc_off: u32,
pub doc_len: u32,
pub doc_body_pending: bool,
pub doc: Option<&'static str>,
}Fields§
§name: &'static str§func: &'static dyn PyNativeFn§flags: PyMethodFlags§doc_off: u32Start of the database body. Read only when doc_len != 0.
Absent when the doc feature is off, as are doc_len and doc_body_pending.
doc_len: u32Length of the database body.
0 means the body is not a database span: doc is the whole text, or there is no body.
doc_body_pending: boolThe body is still taken from the owning class’s attribute table.
True only when the method has no Rust doc body and expansion did not
resolve a database span. concat_with_attr_docs copies that span into
doc_off/doc_len when the table has one, then sets this to false.
False means the body is already settled: a Rust doc, a span resolved
while expanding the method, or no body at all.
doc: Option<&'static str>Static text beside the database span.
None when there is no static text: the body is the doc_len span, or there is no docstring.
Some is a plain docstring, a full internal docstring, or only the
signature prefix while the body is the doc_len span or still pending.
Implementations§
Source§impl PyMethodDef
impl PyMethodDef
pub fn item_doc(&self) -> ItemDoc
pub const fn new_const<Kind>( name: &'static str, func: impl IntoPyNativeFn<Kind>, flags: PyMethodFlags, doc: ItemDoc, ) -> Self
pub const fn new_raw_const( name: &'static str, func: impl PyNativeFn, flags: PyMethodFlags, doc: ItemDoc, ) -> Self
pub fn to_proper_method( &'static self, class: &'static Py<PyType>, ctx: &Context, ) -> PyObjectRef
pub const fn to_function(&'static self) -> PyNativeFunction
pub fn to_method( &'static self, class: &'static Py<PyType>, ctx: &Context, ) -> PyMethodDescriptor
pub const 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<PyClassMethodDescriptor>
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
Auto Trait Implementations§
impl !RefUnwindSafe for PyMethodDef
impl !Send for PyMethodDef
impl !Sync for PyMethodDef
impl !UnwindSafe for PyMethodDef
impl Freeze for PyMethodDef
impl Unpin for PyMethodDef
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> Helper for T
Source§impl<T, U> ImaginaryInto<U> for Twhere
U: ImaginaryFrom<T>,
impl<T, U> ImaginaryInto<U> for Twhere
U: ImaginaryFrom<T>,
fn imaginary_into(self) -> U
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> ⓘ
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> ⓘ
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