add class properties

This commit is contained in:
Nikolay Kim 2017-04-06 10:03:03 -07:00
parent d7ce1c0af0
commit ffe774a8cc
8 changed files with 437 additions and 220 deletions

View File

@ -23,6 +23,7 @@ mod py_class_impl2;
mod py_class_impl3; mod py_class_impl3;
#[doc(hidden)] pub mod slots; #[doc(hidden)] pub mod slots;
#[doc(hidden)] pub mod members; #[doc(hidden)] pub mod members;
#[doc(hidden)] pub mod properties;
pub mod gc; pub mod gc;
use libc; use libc;

137
src/py_class/properties.rs Normal file
View File

@ -0,0 +1,137 @@
use ffi;
pub fn type_error_to_unit(py: ::Python, e: ::PyErr) -> ::PyResult<()> {
if e.matches(py, py.get_type::<::exc::TypeError>()) {
Ok(())
} else {
Err(e)
}
}
#[macro_export]
#[doc(hidden)]
macro_rules! py_class_init_properties {
($class:ident, $py:ident, $type_object: ident, { }) => {{}};
($class:ident, $py:ident, $type_object: ident, { $( $prop:expr; )+ }) =>
{ unsafe {
let mut defs = Vec::new();
$(defs.push($prop);)+
defs.push(
$crate::_detail::ffi::PyGetSetDef {
name: 0 as *mut $crate::_detail::libc::c_char,
get: None,
set: None,
doc: 0 as *mut $crate::_detail::libc::c_char,
closure: 0 as *mut $crate::_detail::libc::c_void,
});
let props = defs.into_boxed_slice();
$type_object.tp_getset =
props.as_ptr() as *mut $crate::_detail::ffi::PyGetSetDef;
std::mem::forget(props);
}};
}
#[macro_export]
#[doc(hidden)]
macro_rules! py_class_property_impl {
({} $class:ident $py:ident $name:ident { $( $descr_name:ident = $descr_expr:expr; )* } ) =>
{{
let mut getset_def: $crate::_detail::ffi::PyGetSetDef =
$crate::_detail::ffi::PyGetSetDef {
name: 0 as *mut $crate::_detail::libc::c_char,
get: None,
set: None,
doc: 0 as *mut $crate::_detail::libc::c_char,
closure: 0 as *mut $crate::_detail::libc::c_void,
};
getset_def.name = concat!(stringify!($name), "\0").as_ptr() as *mut _;
$( getset_def.$descr_name = Some($descr_expr); )*
getset_def
}};
( { get (&$slf:ident) -> $res_type:ty { $($body:tt)* } $($tail:tt)* }
$class:ident $py:ident $name:ident { $( $descr_name:ident = $descr_expr:expr; )* } ) =>
{
py_class_property_impl!{
{ $($tail)* } $class $py $name
/* methods: */ {
$( $descr_name = $descr_expr; )*
get = {
unsafe extern "C" fn wrap_getter_method(
slf: *mut $crate::_detail::ffi::PyObject,
_: *mut $crate::_detail::libc::c_void)
-> *mut $crate::_detail::ffi::PyObject
{
const LOCATION: &'static str = concat!(
stringify!($class), ".getter_", stringify!($name), "()");
fn get($slf: &$class, $py: $crate::Python) -> $res_type {
$($body)*
};
$crate::_detail::handle_callback(
LOCATION, $crate::_detail::PyObjectCallbackConverter,
|py| {
let slf = $crate::PyObject::from_borrowed_ptr(
py, slf).unchecked_cast_into::<$class>();
let ret = get(&slf, py);
$crate::PyDrop::release_ref(slf, py);
ret
})
}
wrap_getter_method
};
}
}
};
( { set(&$slf:ident, $value:ident : $value_type:ty)
-> $res_type:ty { $( $body:tt )* } $($tail:tt)* }
$class:ident $py:ident $name:ident { $( $descr_name:ident = $descr_expr:expr; )* } ) =>
{
py_class_property_impl! {
{ $($tail)* } $class $py $name
/* methods: */ {
$( $descr_name = $descr_expr; )*
set = {
unsafe extern "C" fn wrap_setter_method(
slf: *mut $crate::_detail::ffi::PyObject,
value: *mut $crate::_detail::ffi::PyObject,
_: *mut $crate::_detail::libc::c_void)
-> $crate::_detail::libc::c_int
{
const LOCATION: &'static str = concat!(
stringify!($class), ".setter_", stringify!($name), "()");
fn set($slf: &$class,
$py: $crate::Python, $value: $value_type) -> $res_type {
$($body)*
};
$crate::_detail::handle_callback(
LOCATION, $crate::py_class::slots::UnitCallbackConverter, move |py| {
let slf = $crate::PyObject::from_borrowed_ptr(py, slf)
.unchecked_cast_into::<$class>();
let value = $crate::PyObject::from_borrowed_ptr(py, value);
let ret = match <$value_type as $crate::FromPyObject>::extract(py, &value) {
Ok(value) => set(&slf, py, value),
Err(e) =>
$crate::py_class::properties::type_error_to_unit(py, e)
};
$crate::PyDrop::release_ref(slf, py);
$crate::PyDrop::release_ref(value, py);
ret
})
}
wrap_setter_method
};
}
}
};
}

View File

@ -428,6 +428,7 @@ macro_rules! py_class {
} }
/* impls: */ { /* impl body */ } /* impls: */ { /* impl body */ }
/* members: */ { /* ident = expr; */ } /* members: */ { /* ident = expr; */ }
/* properties: */ { /* expr; */ }
} }
); );
(pub class $class:ident |$py: ident| { $( $body:tt )* }) => ( (pub class $class:ident |$py: ident| { $( $body:tt )* }) => (
@ -459,10 +460,12 @@ macro_rules! py_class {
} }
/* impls: */ { /* impl body */ } /* impls: */ { /* impl body */ }
/* members: */ { /* ident = expr; */ } /* members: */ { /* ident = expr; */ }
/* properties: */ { /* expr; */ }
} }
); );
} }
#[macro_export] #[macro_export]
#[doc(hidden)] #[doc(hidden)]
macro_rules! py_class_impl_item { macro_rules! py_class_impl_item {

View File

@ -47,7 +47,7 @@ base_case = '''
$gc:tt, $gc:tt,
/* data: */ [ $( { $data_offset:expr, $data_name:ident, $data_ty:ty } )* ] /* data: */ [ $( { $data_offset:expr, $data_name:ident, $data_ty:ty } )* ]
} }
$slots:tt { $( $imp:item )* } $members:tt $slots:tt { $( $imp:item )* } $members:tt $properties:tt
} => { } => {
py_coerce_item! { py_coerce_item! {
$($class_visibility)* struct $class { _unsafe_inner: $crate::PyObject } $($class_visibility)* struct $class { _unsafe_inner: $crate::PyObject }
@ -184,6 +184,7 @@ base_case = '''
fn init($py: $crate::Python, module_name: Option<&str>) -> $crate::PyResult<$crate::PyType> { fn init($py: $crate::Python, module_name: Option<&str>) -> $crate::PyResult<$crate::PyType> {
py_class_type_object_dynamic_init!($class, $py, TYPE_OBJECT, module_name, $slots); py_class_type_object_dynamic_init!($class, $py, TYPE_OBJECT, module_name, $slots);
py_class_init_members!($class, $py, TYPE_OBJECT, $members); py_class_init_members!($class, $py, TYPE_OBJECT, $members);
py_class_init_properties!($class, $py, TYPE_OBJECT, $properties);
unsafe { unsafe {
if $crate::_detail::ffi::PyType_Ready(&mut TYPE_OBJECT) == 0 { if $crate::_detail::ffi::PyType_Ready(&mut TYPE_OBJECT) == 0 {
Ok($crate::PyType::from_type_ptr($py, &mut TYPE_OBJECT)) Ok($crate::PyType::from_type_ptr($py, &mut TYPE_OBJECT))
@ -196,6 +197,18 @@ base_case = '''
} }
} }
}; };
{ { property $name:ident { $($body:tt)* } $($tail:tt)* }
$class:ident $py:ident $info:tt $slots:tt { $( $imp:item )* } $members:tt
{ $( $properties:expr; )* }
} => { py_class_impl! {
{ $($tail)* }
$class $py $info $slots { $($imp)* } $members
/* properties: */ {
$( $properties; )*
py_class_property_impl! { { $($body)* } $class $py $name { } };
}
}};
''' '''
indentation = [' '] indentation = [' ']
@ -287,6 +300,9 @@ def generate_case(pattern, old_info=None, new_info=None, new_impl=None, new_slot
write('\n{ $( $member_name:ident = $member_expr:expr; )* }') write('\n{ $( $member_name:ident = $member_expr:expr; )* }')
else: else:
write('$members:tt') write('$members:tt')
write('$properties:tt')
write('\n} => { py_class_impl! {\n') write('\n} => { py_class_impl! {\n')
write('{ $($tail)* }\n') write('{ $($tail)* }\n')
write('$class $py') write('$class $py')
@ -329,6 +345,7 @@ def generate_case(pattern, old_info=None, new_info=None, new_impl=None, new_slot
write('}') write('}')
else: else:
write('$members') write('$members')
write('$properties')
write('\n}};\n') write('\n}};\n')
def data_decl(): def data_decl():

View File

@ -39,7 +39,7 @@ macro_rules! py_class_impl {
$gc:tt, $gc:tt,
/* data: */ [ $( { $data_offset:expr, $data_name:ident, $data_ty:ty } )* ] /* data: */ [ $( { $data_offset:expr, $data_name:ident, $data_ty:ty } )* ]
} }
$slots:tt { $( $imp:item )* } $members:tt $slots:tt { $( $imp:item )* } $members:tt $properties:tt
} => { } => {
py_coerce_item! { py_coerce_item! {
$($class_visibility)* struct $class { _unsafe_inner: $crate::PyObject } $($class_visibility)* struct $class { _unsafe_inner: $crate::PyObject }
@ -176,6 +176,7 @@ macro_rules! py_class_impl {
fn init($py: $crate::Python, module_name: Option<&str>) -> $crate::PyResult<$crate::PyType> { fn init($py: $crate::Python, module_name: Option<&str>) -> $crate::PyResult<$crate::PyType> {
py_class_type_object_dynamic_init!($class, $py, TYPE_OBJECT, module_name, $slots); py_class_type_object_dynamic_init!($class, $py, TYPE_OBJECT, module_name, $slots);
py_class_init_members!($class, $py, TYPE_OBJECT, $members); py_class_init_members!($class, $py, TYPE_OBJECT, $members);
py_class_init_properties!($class, $py, TYPE_OBJECT, $properties);
unsafe { unsafe {
if $crate::_detail::ffi::PyType_Ready(&mut TYPE_OBJECT) == 0 { if $crate::_detail::ffi::PyType_Ready(&mut TYPE_OBJECT) == 0 {
Ok($crate::PyType::from_type_ptr($py, &mut TYPE_OBJECT)) Ok($crate::PyType::from_type_ptr($py, &mut TYPE_OBJECT))
@ -189,6 +190,18 @@ macro_rules! py_class_impl {
} }
}; };
{ { property $name:ident { $($body:tt)* } $($tail:tt)* }
$class:ident $py:ident $info:tt $slots:tt { $( $imp:item )* } $members:tt
{ $( $properties:expr; )* }
} => { py_class_impl! {
{ $($tail)* }
$class $py $info $slots { $($imp)* } $members
/* properties: */ {
$( $properties; )*
py_class_property_impl! { { $($body)* } $class $py $name { } };
}
}};
{ { data $data_name:ident : $data_type:ty; $($tail:tt)* } { { data $data_name:ident : $data_type:ty; $($tail:tt)* }
$class:ident $py:ident $class:ident $py:ident
/* info: */ { /* info: */ {
@ -200,7 +213,7 @@ macro_rules! py_class_impl {
} }
$slots:tt $slots:tt
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $class $py
@ -233,7 +246,7 @@ macro_rules! py_class_impl {
} }
} }
} }
$members $members $properties
}}; }};
{ { def __traverse__(&$slf:tt, $visit:ident) $body:block $($tail:tt)* } { { def __traverse__(&$slf:tt, $visit:ident) $body:block $($tail:tt)* }
$class:ident $py:ident $class:ident $py:ident
@ -249,7 +262,7 @@ macro_rules! py_class_impl {
} }
$slots:tt $slots:tt
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $class $py
@ -276,7 +289,7 @@ macro_rules! py_class_impl {
} }
} }
} }
$members $members $properties
}}; }};
{ { def __clear__ (&$slf:ident) $body:block $($tail:tt)* } { { def __clear__ (&$slf:ident) $body:block $($tail:tt)* }
$class:ident $py:ident $info:tt $class:ident $py:ident $info:tt
@ -285,7 +298,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -304,7 +317,7 @@ macro_rules! py_class_impl {
} }
} }
} }
$members $members $properties
}}; }};
{ { def __abs__(&$slf:ident) -> $res_type:ty { $($body:tt)* } $($tail:tt)* } { { def __abs__(&$slf:ident) -> $res_type:ty { $($body:tt)* } $($tail:tt)* }
$class:ident $py:ident $info:tt $class:ident $py:ident $info:tt
@ -314,7 +327,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -330,7 +343,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __abs__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __abs__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __abs__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __abs__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -344,7 +357,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -360,7 +373,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __add__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] } py_class_impl_item! { $class, $py, __add__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] }
} }
$members $members $properties
}}; }};
{ { def __add__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __add__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -382,7 +395,7 @@ macro_rules! py_class_impl {
$as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -398,7 +411,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __aiter__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __aiter__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __aiter__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __aiter__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -412,7 +425,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -428,7 +441,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __and__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] } py_class_impl_item! { $class, $py, __and__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] }
} }
$members $members $properties
}}; }};
{ { def __and__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __and__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -442,7 +455,7 @@ macro_rules! py_class_impl {
$as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -458,7 +471,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __anext__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __anext__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __anext__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __anext__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -472,7 +485,7 @@ macro_rules! py_class_impl {
$as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -488,7 +501,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __await__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __await__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __await__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __await__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -502,7 +515,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -518,7 +531,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __bool__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __bool__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __bool__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __bool__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -532,7 +545,7 @@ macro_rules! py_class_impl {
$setdelitem:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -548,7 +561,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __buffer_get__(&$slf,) $res_type; { $($body)* } [{ $view : *mut $crate::_detail::ffi::Py_buffer = {} } { $flags : $crate::_detail::libc::c_int = {} }] } py_class_impl_item! { $class, $py, __buffer_get__(&$slf,) $res_type; { $($body)* } [{ $view : *mut $crate::_detail::ffi::Py_buffer = {} } { $flags : $crate::_detail::libc::c_int = {} }] }
} }
$members $members $properties
}}; }};
{ { def __buffer_get__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __buffer_get__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -562,7 +575,7 @@ macro_rules! py_class_impl {
$setdelitem:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -578,7 +591,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __buffer_release__(&$slf,) $res_type; { $($body)* } [{ $view : *mut $crate::_detail::ffi::Py_buffer = {} }] } py_class_impl_item! { $class, $py, __buffer_release__(&$slf,) $res_type; { $($body)* } [{ $view : *mut $crate::_detail::ffi::Py_buffer = {} }] }
} }
$members $members $properties
}}; }};
{ { def __buffer_release__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __buffer_release__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -591,7 +604,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -606,7 +619,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __call__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __call__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __call__ (&$slf:ident, $($p:tt)+) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* } { { def __call__ (&$slf:ident, $($p:tt)+) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* }
$class:ident $py:ident $info:tt $class:ident $py:ident $info:tt
@ -615,7 +628,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -633,7 +646,7 @@ macro_rules! py_class_impl {
[] ($($p)+,) [] ($($p)+,)
} }
} }
$members $members $properties
}}; }};
{ { def __cmp__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __cmp__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -655,7 +668,7 @@ macro_rules! py_class_impl {
$as_mapping:tt $as_buffer:tt $setdelitem:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -671,7 +684,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __contains__(&$slf,) $res_type; { $($body)* } [{ $item : $item_type = {} }] } py_class_impl_item! { $class, $py, __contains__(&$slf,) $res_type; { $($body)* } [{ $item : $item_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __contains__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __contains__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -699,7 +712,7 @@ macro_rules! py_class_impl {
] ]
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -714,7 +727,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __delitem__(&$slf,) $res_type; { $($body)* } [{ $key : $key_type = {} }] } py_class_impl_item! { $class, $py, __delitem__(&$slf,) $res_type; { $($body)* } [{ $key : $key_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __delitem__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __delitem__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -769,7 +782,7 @@ macro_rules! py_class_impl {
$as_buffer:tt $setdelitem:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -789,7 +802,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __getitem__(&$slf,) $res_type; { $($body)* } [{ $key : $key_type = {} }] } py_class_impl_item! { $class, $py, __getitem__(&$slf,) $res_type; { $($body)* } [{ $key : $key_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __getitem__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __getitem__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -806,7 +819,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -821,7 +834,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __hash__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __hash__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __hash__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __hash__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -835,7 +848,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -851,7 +864,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __iadd__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __iadd__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __iadd__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __iadd__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -865,7 +878,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -881,7 +894,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __iand__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __iand__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __iand__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __iand__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -899,7 +912,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -915,7 +928,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __ifloordiv__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __ifloordiv__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __ifloordiv__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __ifloordiv__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -929,7 +942,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -945,7 +958,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __ilshift__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __ilshift__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __ilshift__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __ilshift__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -959,7 +972,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -975,7 +988,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __imatmul__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __imatmul__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __imatmul__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __imatmul__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -989,7 +1002,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1005,7 +1018,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __imod__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __imod__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __imod__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __imod__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1019,7 +1032,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1035,7 +1048,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __imul__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __imul__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __imul__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __imul__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1065,7 +1078,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1081,7 +1094,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __invert__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __invert__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __invert__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __invert__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1095,7 +1108,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1111,7 +1124,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __ior__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __ior__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __ior__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __ior__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1129,7 +1142,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1145,7 +1158,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __irshift__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __irshift__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __irshift__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __irshift__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1159,7 +1172,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1175,7 +1188,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __isub__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __isub__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __isub__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __isub__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1188,7 +1201,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1203,7 +1216,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __iter__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __iter__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __iter__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __iter__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1217,7 +1230,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1233,7 +1246,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __itruediv__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __itruediv__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __itruediv__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __itruediv__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1247,7 +1260,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1263,7 +1276,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __ixor__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __ixor__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __ixor__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __ixor__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1282,7 +1295,7 @@ macro_rules! py_class_impl {
$as_buffer:tt $setdelitem:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1302,7 +1315,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __len__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __len__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __len__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __len__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1320,7 +1333,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1336,7 +1349,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __lshift__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] } py_class_impl_item! { $class, $py, __lshift__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] }
} }
$members $members $properties
}}; }};
{ { def __lshift__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __lshift__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1362,7 +1375,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1378,7 +1391,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __mul__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] } py_class_impl_item! { $class, $py, __mul__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] }
} }
$members $members $properties
}}; }};
{ { def __mul__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __mul__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1396,7 +1409,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1412,7 +1425,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __neg__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __neg__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __neg__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __neg__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1425,7 +1438,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1440,7 +1453,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py,__new__($cls: &$crate::PyType,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py,__new__($cls: &$crate::PyType,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __new__ ($cls:ident, $($p:tt)+) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* } { { def __new__ ($cls:ident, $($p:tt)+) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* }
$class:ident $py:ident $info:tt $class:ident $py:ident $info:tt
@ -1449,7 +1462,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1467,7 +1480,7 @@ macro_rules! py_class_impl {
[] ($($p)+,) [] ($($p)+,)
} }
} }
$members $members $properties
}}; }};
{ { def __next__(&$slf:ident) -> $res_type:ty { $($body:tt)* } $($tail:tt)* } { { def __next__(&$slf:ident) -> $res_type:ty { $($body:tt)* } $($tail:tt)* }
$class:ident $py:ident $info:tt $class:ident $py:ident $info:tt
@ -1476,7 +1489,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1491,7 +1504,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __next__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __next__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __next__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __next__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1509,7 +1522,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1525,7 +1538,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __or__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] } py_class_impl_item! { $class, $py, __or__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] }
} }
$members $members $properties
}}; }};
{ { def __or__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __or__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1539,7 +1552,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1555,7 +1568,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __pos__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __pos__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __pos__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __pos__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1588,7 +1601,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1603,7 +1616,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __repr__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __repr__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __repr__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __repr__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1620,7 +1633,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1635,7 +1648,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __richcmp__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} } { $op : $op_type = {} }] } py_class_impl_item! { $class, $py, __richcmp__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} } { $op : $op_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __richcmp__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __richcmp__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1681,7 +1694,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1697,7 +1710,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __rshift__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] } py_class_impl_item! { $class, $py, __rshift__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] }
} }
$members $members $properties
}}; }};
{ { def __rshift__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __rshift__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1733,7 +1746,7 @@ macro_rules! py_class_impl {
] ]
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1748,7 +1761,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __setitem__(&$slf,) $res_type; { $($body)* } [{ $key : $key_type = {} } { $value : $value_type = {} }] } py_class_impl_item! { $class, $py, __setitem__(&$slf,) $res_type; { $($body)* } [{ $key : $key_type = {} } { $value : $value_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __setitem__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __setitem__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1761,7 +1774,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1776,7 +1789,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __str__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __str__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __str__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __str__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1790,7 +1803,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1806,7 +1819,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __sub__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] } py_class_impl_item! { $class, $py, __sub__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] }
} }
$members $members $properties
}}; }};
{ { def __sub__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __sub__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1828,7 +1841,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1844,7 +1857,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __xor__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] } py_class_impl_item! { $class, $py, __xor__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] }
} }
$members $members $properties
}}; }};
{ { def __xor__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __xor__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1853,7 +1866,7 @@ macro_rules! py_class_impl {
{ { def $name:ident (&$slf:ident) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* } { { def $name:ident (&$slf:ident) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* }
$class:ident $py:ident $info:tt $slots:tt $class:ident $py:ident $info:tt $slots:tt
{ $( $imp:item )* } { $( $imp:item )* }
{ $( $member_name:ident = $member_expr:expr; )* } { $( $member_name:ident = $member_expr:expr; )* } $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $slots $class $py $info $slots
@ -1864,12 +1877,12 @@ macro_rules! py_class_impl {
/* members: */ { /* members: */ {
$( $member_name = $member_expr; )* $( $member_name = $member_expr; )*
$name = py_class_instance_method!{$py, $class::$name []}; $name = py_class_instance_method!{$py, $class::$name []};
} } $properties
}}; }};
{ { def $name:ident (&$slf:ident, $($p:tt)+) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* } { { def $name:ident (&$slf:ident, $($p:tt)+) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* }
$class:ident $py:ident $info:tt $slots:tt $class:ident $py:ident $info:tt $slots:tt
{ $( $imp:item )* } { $( $imp:item )* }
{ $( $member_name:ident = $member_expr:expr; )* } { $( $member_name:ident = $member_expr:expr; )* } $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $slots $class $py $info $slots
@ -1883,12 +1896,12 @@ macro_rules! py_class_impl {
/* members: */ { /* members: */ {
$( $member_name = $member_expr; )* $( $member_name = $member_expr; )*
$name = py_argparse_parse_plist_impl!{py_class_instance_method {$py, $class::$name} [] ($($p)+,)}; $name = py_argparse_parse_plist_impl!{py_class_instance_method {$py, $class::$name} [] ($($p)+,)};
} } $properties
}}; }};
{ { @classmethod def $name:ident ($cls:ident) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* } { { @classmethod def $name:ident ($cls:ident) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* }
$class:ident $py:ident $info:tt $slots:tt $class:ident $py:ident $info:tt $slots:tt
{ $( $imp:item )* } { $( $imp:item )* }
{ $( $member_name:ident = $member_expr:expr; )* } { $( $member_name:ident = $member_expr:expr; )* } $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $slots $class $py $info $slots
@ -1899,12 +1912,12 @@ macro_rules! py_class_impl {
/* members: */ { /* members: */ {
$( $member_name = $member_expr; )* $( $member_name = $member_expr; )*
$name = py_class_class_method!{$py, $class::$name []}; $name = py_class_class_method!{$py, $class::$name []};
} } $properties
}}; }};
{ { @classmethod def $name:ident ($cls:ident, $($p:tt)+) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* } { { @classmethod def $name:ident ($cls:ident, $($p:tt)+) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* }
$class:ident $py:ident $info:tt $slots:tt $class:ident $py:ident $info:tt $slots:tt
{ $( $imp:item )* } { $( $imp:item )* }
{ $( $member_name:ident = $member_expr:expr; )* } { $( $member_name:ident = $member_expr:expr; )* } $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $slots $class $py $info $slots
@ -1918,12 +1931,12 @@ macro_rules! py_class_impl {
/* members: */ { /* members: */ {
$( $member_name = $member_expr; )* $( $member_name = $member_expr; )*
$name = py_argparse_parse_plist_impl!{py_class_class_method {$py, $class::$name} [] ($($p)+,)}; $name = py_argparse_parse_plist_impl!{py_class_class_method {$py, $class::$name} [] ($($p)+,)};
} } $properties
}}; }};
{ { @staticmethod def $name:ident ($($p:tt)*) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* } { { @staticmethod def $name:ident ($($p:tt)*) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* }
$class:ident $py:ident $info:tt $slots:tt $class:ident $py:ident $info:tt $slots:tt
{ $( $imp:item )* } { $( $imp:item )* }
{ $( $member_name:ident = $member_expr:expr; )* } { $( $member_name:ident = $member_expr:expr; )* } $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $slots $class $py $info $slots
@ -1942,18 +1955,18 @@ macro_rules! py_class_impl {
($($p)*) ($($p)*)
} }
; ;
} } $properties
}}; }};
{ { static $name:ident = $init:expr; $($tail:tt)* } { { static $name:ident = $init:expr; $($tail:tt)* }
$class:ident $py:ident $info:tt $slots:tt $impls:tt $class:ident $py:ident $info:tt $slots:tt $impls:tt
{ $( $member_name:ident = $member_expr:expr; )* } { $( $member_name:ident = $member_expr:expr; )* } $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $slots $impls $class $py $info $slots $impls
/* members: */ { /* members: */ {
$( $member_name = $member_expr; )* $( $member_name = $member_expr; )*
$name = $init; $name = $init;
} } $properties
}}; }};
} }

View File

@ -39,7 +39,7 @@ macro_rules! py_class_impl {
$gc:tt, $gc:tt,
/* data: */ [ $( { $data_offset:expr, $data_name:ident, $data_ty:ty } )* ] /* data: */ [ $( { $data_offset:expr, $data_name:ident, $data_ty:ty } )* ]
} }
$slots:tt { $( $imp:item )* } $members:tt $slots:tt { $( $imp:item )* } $members:tt $properties:tt
} => { } => {
py_coerce_item! { py_coerce_item! {
$($class_visibility)* struct $class { _unsafe_inner: $crate::PyObject } $($class_visibility)* struct $class { _unsafe_inner: $crate::PyObject }
@ -176,6 +176,7 @@ macro_rules! py_class_impl {
fn init($py: $crate::Python, module_name: Option<&str>) -> $crate::PyResult<$crate::PyType> { fn init($py: $crate::Python, module_name: Option<&str>) -> $crate::PyResult<$crate::PyType> {
py_class_type_object_dynamic_init!($class, $py, TYPE_OBJECT, module_name, $slots); py_class_type_object_dynamic_init!($class, $py, TYPE_OBJECT, module_name, $slots);
py_class_init_members!($class, $py, TYPE_OBJECT, $members); py_class_init_members!($class, $py, TYPE_OBJECT, $members);
py_class_init_properties!($class, $py, TYPE_OBJECT, $properties);
unsafe { unsafe {
if $crate::_detail::ffi::PyType_Ready(&mut TYPE_OBJECT) == 0 { if $crate::_detail::ffi::PyType_Ready(&mut TYPE_OBJECT) == 0 {
Ok($crate::PyType::from_type_ptr($py, &mut TYPE_OBJECT)) Ok($crate::PyType::from_type_ptr($py, &mut TYPE_OBJECT))
@ -189,6 +190,18 @@ macro_rules! py_class_impl {
} }
}; };
{ { property $name:ident { $($body:tt)* } $($tail:tt)* }
$class:ident $py:ident $info:tt $slots:tt { $( $imp:item )* } $members:tt
{ $( $properties:expr; )* }
} => { py_class_impl! {
{ $($tail)* }
$class $py $info $slots { $($imp)* } $members
/* properties: */ {
$( $properties; )*
py_class_property_impl! { { $($body)* } $class $py $name { } };
}
}};
{ { data $data_name:ident : $data_type:ty; $($tail:tt)* } { { data $data_name:ident : $data_type:ty; $($tail:tt)* }
$class:ident $py:ident $class:ident $py:ident
/* info: */ { /* info: */ {
@ -200,7 +213,7 @@ macro_rules! py_class_impl {
} }
$slots:tt $slots:tt
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $class $py
@ -233,7 +246,7 @@ macro_rules! py_class_impl {
} }
} }
} }
$members $members $properties
}}; }};
{ { def __traverse__(&$slf:tt, $visit:ident) $body:block $($tail:tt)* } { { def __traverse__(&$slf:tt, $visit:ident) $body:block $($tail:tt)* }
$class:ident $py:ident $class:ident $py:ident
@ -249,7 +262,7 @@ macro_rules! py_class_impl {
} }
$slots:tt $slots:tt
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $class $py
@ -276,7 +289,7 @@ macro_rules! py_class_impl {
} }
} }
} }
$members $members $properties
}}; }};
{ { def __clear__ (&$slf:ident) $body:block $($tail:tt)* } { { def __clear__ (&$slf:ident) $body:block $($tail:tt)* }
$class:ident $py:ident $info:tt $class:ident $py:ident $info:tt
@ -285,7 +298,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -304,7 +317,7 @@ macro_rules! py_class_impl {
} }
} }
} }
$members $members $properties
}}; }};
{ { def __abs__(&$slf:ident) -> $res_type:ty { $($body:tt)* } $($tail:tt)* } { { def __abs__(&$slf:ident) -> $res_type:ty { $($body:tt)* } $($tail:tt)* }
$class:ident $py:ident $info:tt $class:ident $py:ident $info:tt
@ -314,7 +327,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -330,7 +343,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __abs__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __abs__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __abs__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __abs__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -344,7 +357,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -360,7 +373,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __add__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] } py_class_impl_item! { $class, $py, __add__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] }
} }
$members $members $properties
}}; }};
{ { def __add__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __add__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -382,7 +395,7 @@ macro_rules! py_class_impl {
$as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -398,7 +411,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __aiter__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __aiter__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __aiter__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __aiter__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -412,7 +425,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -428,7 +441,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __and__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] } py_class_impl_item! { $class, $py, __and__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] }
} }
$members $members $properties
}}; }};
{ { def __and__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __and__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -442,7 +455,7 @@ macro_rules! py_class_impl {
$as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -458,7 +471,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __anext__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __anext__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __anext__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __anext__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -472,7 +485,7 @@ macro_rules! py_class_impl {
$as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -488,7 +501,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __await__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __await__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __await__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __await__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -502,7 +515,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -518,7 +531,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __bool__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __bool__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __bool__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __bool__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -532,7 +545,7 @@ macro_rules! py_class_impl {
$setdelitem:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -548,7 +561,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __buffer_get__(&$slf,) $res_type; { $($body)* } [{ $view : *mut $crate::_detail::ffi::Py_buffer = {} } { $flags : $crate::_detail::libc::c_int = {} }] } py_class_impl_item! { $class, $py, __buffer_get__(&$slf,) $res_type; { $($body)* } [{ $view : *mut $crate::_detail::ffi::Py_buffer = {} } { $flags : $crate::_detail::libc::c_int = {} }] }
} }
$members $members $properties
}}; }};
{ { def __buffer_get__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __buffer_get__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -562,7 +575,7 @@ macro_rules! py_class_impl {
$setdelitem:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -578,7 +591,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __buffer_release__(&$slf,) $res_type; { $($body)* } [{ $view : *mut $crate::_detail::ffi::Py_buffer = {} }] } py_class_impl_item! { $class, $py, __buffer_release__(&$slf,) $res_type; { $($body)* } [{ $view : *mut $crate::_detail::ffi::Py_buffer = {} }] }
} }
$members $members $properties
}}; }};
{ { def __buffer_release__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __buffer_release__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -591,7 +604,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -606,7 +619,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __call__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __call__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __call__ (&$slf:ident, $($p:tt)+) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* } { { def __call__ (&$slf:ident, $($p:tt)+) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* }
$class:ident $py:ident $info:tt $class:ident $py:ident $info:tt
@ -615,7 +628,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -633,7 +646,7 @@ macro_rules! py_class_impl {
[] ($($p)+,) [] ($($p)+,)
} }
} }
$members $members $properties
}}; }};
{ { def __cmp__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __cmp__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -655,7 +668,7 @@ macro_rules! py_class_impl {
$as_mapping:tt $as_buffer:tt $setdelitem:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -671,7 +684,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __contains__(&$slf,) $res_type; { $($body)* } [{ $item : $item_type = {} }] } py_class_impl_item! { $class, $py, __contains__(&$slf,) $res_type; { $($body)* } [{ $item : $item_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __contains__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __contains__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -699,7 +712,7 @@ macro_rules! py_class_impl {
] ]
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -714,7 +727,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __delitem__(&$slf,) $res_type; { $($body)* } [{ $key : $key_type = {} }] } py_class_impl_item! { $class, $py, __delitem__(&$slf,) $res_type; { $($body)* } [{ $key : $key_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __delitem__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __delitem__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -769,7 +782,7 @@ macro_rules! py_class_impl {
$as_buffer:tt $setdelitem:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -789,7 +802,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __getitem__(&$slf,) $res_type; { $($body)* } [{ $key : $key_type = {} }] } py_class_impl_item! { $class, $py, __getitem__(&$slf,) $res_type; { $($body)* } [{ $key : $key_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __getitem__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __getitem__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -806,7 +819,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -821,7 +834,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __hash__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __hash__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __hash__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __hash__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -835,7 +848,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -851,7 +864,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __iadd__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __iadd__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __iadd__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __iadd__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -865,7 +878,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -881,7 +894,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __iand__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __iand__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __iand__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __iand__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -899,7 +912,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -915,7 +928,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __ifloordiv__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __ifloordiv__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __ifloordiv__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __ifloordiv__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -929,7 +942,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -945,7 +958,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __ilshift__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __ilshift__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __ilshift__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __ilshift__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -959,7 +972,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -975,7 +988,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __imatmul__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __imatmul__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __imatmul__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __imatmul__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -989,7 +1002,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1005,7 +1018,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __imod__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __imod__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __imod__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __imod__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1019,7 +1032,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1035,7 +1048,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __imul__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __imul__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __imul__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __imul__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1065,7 +1078,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1081,7 +1094,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __invert__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __invert__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __invert__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __invert__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1095,7 +1108,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1111,7 +1124,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __ior__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __ior__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __ior__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __ior__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1129,7 +1142,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1145,7 +1158,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __irshift__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __irshift__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __irshift__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __irshift__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1159,7 +1172,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1175,7 +1188,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __isub__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __isub__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __isub__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __isub__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1188,7 +1201,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1203,7 +1216,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __iter__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __iter__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __iter__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __iter__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1217,7 +1230,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1233,7 +1246,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __itruediv__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __itruediv__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __itruediv__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __itruediv__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1247,7 +1260,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1263,7 +1276,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __ixor__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] } py_class_impl_item! { $class, $py, __ixor__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __ixor__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __ixor__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1282,7 +1295,7 @@ macro_rules! py_class_impl {
$as_buffer:tt $setdelitem:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1302,7 +1315,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __len__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __len__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __len__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __len__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1320,7 +1333,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1336,7 +1349,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __lshift__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] } py_class_impl_item! { $class, $py, __lshift__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] }
} }
$members $members $properties
}}; }};
{ { def __lshift__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __lshift__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1362,7 +1375,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1378,7 +1391,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __mul__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] } py_class_impl_item! { $class, $py, __mul__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] }
} }
$members $members $properties
}}; }};
{ { def __mul__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __mul__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1396,7 +1409,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1412,7 +1425,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __neg__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __neg__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __neg__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __neg__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1425,7 +1438,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1440,7 +1453,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py,__new__($cls: &$crate::PyType,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py,__new__($cls: &$crate::PyType,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __new__ ($cls:ident, $($p:tt)+) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* } { { def __new__ ($cls:ident, $($p:tt)+) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* }
$class:ident $py:ident $info:tt $class:ident $py:ident $info:tt
@ -1449,7 +1462,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1467,7 +1480,7 @@ macro_rules! py_class_impl {
[] ($($p)+,) [] ($($p)+,)
} }
} }
$members $members $properties
}}; }};
{ { def __next__(&$slf:ident) -> $res_type:ty { $($body:tt)* } $($tail:tt)* } { { def __next__(&$slf:ident) -> $res_type:ty { $($body:tt)* } $($tail:tt)* }
$class:ident $py:ident $info:tt $class:ident $py:ident $info:tt
@ -1476,7 +1489,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1491,7 +1504,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __next__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __next__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __next__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __next__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1509,7 +1522,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1525,7 +1538,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __or__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] } py_class_impl_item! { $class, $py, __or__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] }
} }
$members $members $properties
}}; }};
{ { def __or__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __or__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1539,7 +1552,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1555,7 +1568,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __pos__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __pos__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __pos__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __pos__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1588,7 +1601,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1603,7 +1616,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __repr__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __repr__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __repr__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __repr__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1620,7 +1633,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1635,7 +1648,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __richcmp__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} } { $op : $op_type = {} }] } py_class_impl_item! { $class, $py, __richcmp__(&$slf,) $res_type; { $($body)* } [{ $other : $other_type = {} } { $op : $op_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __richcmp__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __richcmp__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1681,7 +1694,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1697,7 +1710,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __rshift__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] } py_class_impl_item! { $class, $py, __rshift__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] }
} }
$members $members $properties
}}; }};
{ { def __rshift__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __rshift__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1733,7 +1746,7 @@ macro_rules! py_class_impl {
] ]
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1748,7 +1761,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __setitem__(&$slf,) $res_type; { $($body)* } [{ $key : $key_type = {} } { $value : $value_type = {} }] } py_class_impl_item! { $class, $py, __setitem__(&$slf,) $res_type; { $($body)* } [{ $key : $key_type = {} } { $value : $value_type = {} }] }
} }
$members $members $properties
}}; }};
{ { def __setitem__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __setitem__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1761,7 +1774,7 @@ macro_rules! py_class_impl {
$as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_async:tt $as_number:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1776,7 +1789,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __str__(&$slf,) $res_type; { $($body)* } [] } py_class_impl_item! { $class, $py, __str__(&$slf,) $res_type; { $($body)* } [] }
} }
$members $members $properties
}}; }};
{ { def __str__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __str__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1790,7 +1803,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1806,7 +1819,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __sub__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] } py_class_impl_item! { $class, $py, __sub__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] }
} }
$members $members $properties
}}; }};
{ { def __sub__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __sub__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1828,7 +1841,7 @@ macro_rules! py_class_impl {
$as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt $as_sequence:tt $as_mapping:tt $as_buffer:tt $setdelitem:tt
} }
{ $( $imp:item )* } { $( $imp:item )* }
$members:tt $members:tt $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $class $py $info
@ -1844,7 +1857,7 @@ macro_rules! py_class_impl {
$($imp)* $($imp)*
py_class_impl_item! { $class, $py, __xor__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] } py_class_impl_item! { $class, $py, __xor__() $res_type; { $($body)* } [ { $left : &$crate::PyObject = {} } { $right : &$crate::PyObject = {} } ] }
} }
$members $members $properties
}}; }};
{ { def __xor__ $($tail:tt)* } $( $stuff:tt )* } => { { { def __xor__ $($tail:tt)* } $( $stuff:tt )* } => {
@ -1853,7 +1866,7 @@ macro_rules! py_class_impl {
{ { def $name:ident (&$slf:ident) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* } { { def $name:ident (&$slf:ident) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* }
$class:ident $py:ident $info:tt $slots:tt $class:ident $py:ident $info:tt $slots:tt
{ $( $imp:item )* } { $( $imp:item )* }
{ $( $member_name:ident = $member_expr:expr; )* } { $( $member_name:ident = $member_expr:expr; )* } $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $slots $class $py $info $slots
@ -1864,12 +1877,12 @@ macro_rules! py_class_impl {
/* members: */ { /* members: */ {
$( $member_name = $member_expr; )* $( $member_name = $member_expr; )*
$name = py_class_instance_method!{$py, $class::$name []}; $name = py_class_instance_method!{$py, $class::$name []};
} } $properties
}}; }};
{ { def $name:ident (&$slf:ident, $($p:tt)+) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* } { { def $name:ident (&$slf:ident, $($p:tt)+) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* }
$class:ident $py:ident $info:tt $slots:tt $class:ident $py:ident $info:tt $slots:tt
{ $( $imp:item )* } { $( $imp:item )* }
{ $( $member_name:ident = $member_expr:expr; )* } { $( $member_name:ident = $member_expr:expr; )* } $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $slots $class $py $info $slots
@ -1883,12 +1896,12 @@ macro_rules! py_class_impl {
/* members: */ { /* members: */ {
$( $member_name = $member_expr; )* $( $member_name = $member_expr; )*
$name = py_argparse_parse_plist_impl!{py_class_instance_method {$py, $class::$name} [] ($($p)+,)}; $name = py_argparse_parse_plist_impl!{py_class_instance_method {$py, $class::$name} [] ($($p)+,)};
} } $properties
}}; }};
{ { @classmethod def $name:ident ($cls:ident) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* } { { @classmethod def $name:ident ($cls:ident) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* }
$class:ident $py:ident $info:tt $slots:tt $class:ident $py:ident $info:tt $slots:tt
{ $( $imp:item )* } { $( $imp:item )* }
{ $( $member_name:ident = $member_expr:expr; )* } { $( $member_name:ident = $member_expr:expr; )* } $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $slots $class $py $info $slots
@ -1899,12 +1912,12 @@ macro_rules! py_class_impl {
/* members: */ { /* members: */ {
$( $member_name = $member_expr; )* $( $member_name = $member_expr; )*
$name = py_class_class_method!{$py, $class::$name []}; $name = py_class_class_method!{$py, $class::$name []};
} } $properties
}}; }};
{ { @classmethod def $name:ident ($cls:ident, $($p:tt)+) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* } { { @classmethod def $name:ident ($cls:ident, $($p:tt)+) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* }
$class:ident $py:ident $info:tt $slots:tt $class:ident $py:ident $info:tt $slots:tt
{ $( $imp:item )* } { $( $imp:item )* }
{ $( $member_name:ident = $member_expr:expr; )* } { $( $member_name:ident = $member_expr:expr; )* } $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $slots $class $py $info $slots
@ -1918,12 +1931,12 @@ macro_rules! py_class_impl {
/* members: */ { /* members: */ {
$( $member_name = $member_expr; )* $( $member_name = $member_expr; )*
$name = py_argparse_parse_plist_impl!{py_class_class_method {$py, $class::$name} [] ($($p)+,)}; $name = py_argparse_parse_plist_impl!{py_class_class_method {$py, $class::$name} [] ($($p)+,)};
} } $properties
}}; }};
{ { @staticmethod def $name:ident ($($p:tt)*) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* } { { @staticmethod def $name:ident ($($p:tt)*) -> $res_type:ty { $( $body:tt )* } $($tail:tt)* }
$class:ident $py:ident $info:tt $slots:tt $class:ident $py:ident $info:tt $slots:tt
{ $( $imp:item )* } { $( $imp:item )* }
{ $( $member_name:ident = $member_expr:expr; )* } { $( $member_name:ident = $member_expr:expr; )* } $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $slots $class $py $info $slots
@ -1942,18 +1955,18 @@ macro_rules! py_class_impl {
($($p)*) ($($p)*)
} }
; ;
} } $properties
}}; }};
{ { static $name:ident = $init:expr; $($tail:tt)* } { { static $name:ident = $init:expr; $($tail:tt)* }
$class:ident $py:ident $info:tt $slots:tt $impls:tt $class:ident $py:ident $info:tt $slots:tt $impls:tt
{ $( $member_name:ident = $member_expr:expr; )* } { $( $member_name:ident = $member_expr:expr; )* } $properties:tt
} => { py_class_impl! { } => { py_class_impl! {
{ $($tail)* } { $($tail)* }
$class $py $info $slots $impls $class $py $info $slots $impls
/* members: */ { /* members: */ {
$( $member_name = $member_expr; )* $( $member_name = $member_expr; )*
$name = $init; $name = $init;
} } $properties
}}; }};
} }

View File

@ -221,7 +221,6 @@ macro_rules! py_class_as_number {
macro_rules! py_class_as_async { macro_rules! py_class_as_async {
([]) => (0 as *mut $crate::_detail::ffi::PyAsyncMethods); ([]) => (0 as *mut $crate::_detail::ffi::PyAsyncMethods);
([$( $slot_name:ident : $slot_value:expr ,)+]) => {{ ([$( $slot_name:ident : $slot_value:expr ,)+]) => {{
println!("register async");
static mut ASYNC_METHODS : $crate::_detail::ffi::PyAsyncMethods static mut ASYNC_METHODS : $crate::_detail::ffi::PyAsyncMethods
= $crate::_detail::ffi::PyAsyncMethods { = $crate::_detail::ffi::PyAsyncMethods {
$( $slot_name : $slot_value, )* $( $slot_name : $slot_value, )*

View File

@ -878,3 +878,37 @@ fn context_manager() {
assert!(c.exit_called(py).get()); assert!(c.exit_called(py).get());
} }
py_class!(class ClassWithProperties |py| {
data num: Cell<i32>;
def get_num(&self) -> PyResult<i32> {
Ok(self.num(py).get())
}
property DATA {
get(&slf) -> PyResult<i32> {
Ok(slf.num(py).get())
}
set(&slf, value: i32) -> PyResult<()> {
slf.num(py).set(value);
Ok(())
}
}
});
#[test]
fn class_with_properties() {
let gil = Python::acquire_gil();
let py = gil.python();
let inst = ClassWithProperties::create_instance(py, Cell::new(10)).unwrap();
py_run!(py, inst, "assert inst.get_num() == 10");
py_run!(py, inst, "assert inst.get_num() == inst.DATA");
py_run!(py, inst, "inst.DATA = 20");
py_run!(py, inst, "assert inst.get_num() == 20");
py_run!(py, inst, "assert inst.get_num() == inst.DATA");
}