You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[pymethods]implMyType{// public API for Python#[name = "my_method"]#[args(arg2 = "None")]fnmy_method_python(&self,arg1:i32,arg2:Option<i32>){match arg2 {Some(arg2) => self.my_method_with_arg2(arg1, arg2),None => self.my_method(arg1),}}}implMyType{// public API for Rustpubfnmy_method(&self,arg1:i32){unimplemented!()}pubfnmy_method_with_arg2(&self,arg1:i32,arg2:i32){unimplemented!()}}
my_method is accessible from Python:
a=MyType()
a.my_method(1)
a.my_method(1, 2)
This is useful to allow the Rust and Python APIs for a type to differ somewhat due to different conventions between Python and Rust.
There is already precedent for this kind of renaming: #[pyclass(name = MyType)]
The text was updated successfully, but these errors were encountered:
Allow code like:
my_method
is accessible from Python:This is useful to allow the Rust and Python APIs for a type to differ somewhat due to different conventions between Python and Rust.
There is already precedent for this kind of renaming:
#[pyclass(name = MyType)]
The text was updated successfully, but these errors were encountered: