fn impl_methods_inventory(cls: &syn::Ident) -> TokenStream {
    // Try to build a unique type for better error messages
    let name = format!("Pyo3MethodsInventoryFor{}", cls.unraw());
    let inventory_cls = syn::Ident::new(&name, Span::call_site());

    quote! {
        #[doc(hidden)]
        pub struct #inventory_cls {
            methods: Vec<pyo3::class::PyMethodDefType>,
        }
        impl pyo3::class::impl_::PyMethodsInventory for #inventory_cls {
            fn new(methods: Vec<pyo3::class::PyMethodDefType>) -> Self {
                Self { methods }
            }
            fn get(&'static self) -> &'static [pyo3::class::PyMethodDefType] {
                &self.methods
            }
        }

        impl pyo3::class::impl_::HasMethodsInventory for #cls {
            type Methods = #inventory_cls;
        }

        pyo3::inventory::collect!(#inventory_cls);
    }
}
/// To allow multiple #[pymethods] block, we define inventory types.
To allow multiple #[pymethods] block, we define inventory types.
To allow multiple # [ pymethods ] block we define inventory types .
fn impl_methods_inventory(cls: &syn::Ident) -> TokenStream {
    // Try to build a unique type for better error messages
    let name = format!("Pyo3MethodsInventoryFor{}", cls.unraw());
    let inventory_cls = syn::Ident::new(&name, Span::call_site());
    quote! {
        #[doc(hidden)]
        pub struct #inventory_cls {
            methods: Vec<pyo3::class::PyMethodDefType>,
        }
        impl pyo3::class::impl_::PyMethodsInventory for #inventory_cls {
            fn new(methods: Vec<pyo3::class::PyMethodDefType>) -> Self {
                Self { methods }
            }
            fn get(&'static self) -> &'static [pyo3::class::PyMethodDefType] {
                &self.methods
            }
        }
        impl pyo3::class::impl_::HasMethodsInventory for #cls {
            type Methods = #inventory_cls;
        }
        pyo3::inventory::collect!(#inventory_cls);
    }
}
fn impl_methods_inventory ( cls : & syn :: Ident ) -> TokenStream { // Try to build a unique type for better error messages let name = format ! ( " " cls unraw ( ) ) ; let inventory_cls = syn :: Ident :: new ( & name , Span :: call_site ( ) ) ; quote ! { [ doc ( hidden ) ] pub struct inventory_cls { methods Vec pyo3 class PyMethodDefType } impl pyo3 class impl_ PyMethodsInventory for inventory_cls { fn new ( methods Vec pyo3 class PyMethodDefType ) Self { Self { methods } } fn get ( ' static self ) ' static [ pyo3 class PyMethodDefType ] { self methods } } impl pyo3 class impl_ HasMethodsInventory for cls { type Methods inventory_cls } pyo3 inventory collect ( inventory_cls ) } }
To allow multiple #[pymethods] block, we define inventory types.
To allow multiple # [ pymethods ] block we define inventory types .
cls
&syn::Ident
cls
&syn::Ident