-
Notifications
You must be signed in to change notification settings - Fork 804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it enable to take &PyClass as arguments as pyfunctions/methods #791
Conversation
//name, | ||
//ty); | ||
} | ||
pub(crate) fn check_ty_optional<'a>(ty: &'a syn::Type) -> Option<&'a syn::Type> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a refactoring.
Not related to the logic so much.
Somehow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. One small nitpick on the test.
Thank you for the review 😉 |
FYI, I think the syntax It's because of this usage of the |
Thanks, have opened #1070 to remember this. |
Resolves #786.
For
C: PyClass
, this PR enables the use of&C
,&mut C
,Option<&C>
andOption<&mut C>
as function/method arguments.The hack I used is
ExtractExt::Target
for&C
, like&C
/&mut C
/Option<&C>
/Option<&mut C>
, extract the argument to<type as ExtractExt::Target>
and insert deref.But, for object protocols, still we need to use
PyRef<C>
orPyRefMut<C>
due to its trait requirements.