use stdpython :: * ; # [deprecated (note = "rython: Python default value(s) for parameter(s) `arg2` were dropped (Rust has no default arguments); every argument must be passed explicitly")] pub fn python_main (arg1 : impl Into < PyObject > , arg2 : impl Into < PyObject >) -> Result < () , PyException > { print (& (format ! ("Main called with {}, {}" , py_display (& (arg1)) , py_display (& (arg2))))) ; return Ok ((arg1) . py_add (& (len (& (arg2))))) ; } pub fn wrapper () -> Result < () , PyException > { return Ok (python_main ("hello" , "world") ?) ; } # [derive (Clone , Default)] pub struct TestClass { } impl TestClass { pub fn new () -> Result < Self , PyException > { Ok (Self :: default ()) } pub fn call_main (& self ,) -> Result < () , PyException > { return Ok (python_main ("class" , "method") ?) ; } } fn main () { let __rython_result = (|| -> Result < () , PyException > { let wrapper_result ; let test_obj ; let class_result ; ; python_main ("direct" , "default") ? ; wrapper_result = wrapper () ? ; ; test_obj = TestClass :: new () ? ; ; class_result = (test_obj) . call_main () ? ; ; print (& (format ! ("Results: {}, {}" , py_display (& (wrapper_result)) , py_display (& (class_result))))) ; Ok (()) }) () ; if let Err (e) = __rython_result { eprintln ! ("{}" , e) ; std :: process :: exit (1) ; } }