-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve ergonomy of calling methods with
pyo3::Bound
Signed-off-by: Andrej Orsula <[email protected]>
- Loading branch information
1 parent
77dc889
commit dd45bb0
Showing
10 changed files
with
450 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
pyo3_bindgen_engine/src/syntax/common/function_definition.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
pub enum FunctionImplementation { | ||
Function(proc_macro2::TokenStream), | ||
Method(TraitMethod), | ||
} | ||
|
||
impl FunctionImplementation { | ||
pub fn empty_function() -> Self { | ||
Self::Function(proc_macro2::TokenStream::new()) | ||
} | ||
|
||
pub fn empty_method() -> Self { | ||
Self::Method(TraitMethod::empty()) | ||
} | ||
} | ||
|
||
pub struct TraitMethod { | ||
pub trait_fn: proc_macro2::TokenStream, | ||
pub impl_fn: proc_macro2::TokenStream, | ||
} | ||
|
||
impl TraitMethod { | ||
pub fn empty() -> Self { | ||
Self { | ||
trait_fn: proc_macro2::TokenStream::new(), | ||
impl_fn: proc_macro2::TokenStream::new(), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
pub(crate) mod attribute_variant; | ||
pub(crate) mod function_definition; | ||
pub(crate) mod ident; | ||
pub(crate) mod path; | ||
|
||
pub use attribute_variant::AttributeVariant; | ||
pub use function_definition::{FunctionImplementation, TraitMethod}; | ||
pub use ident::Ident; | ||
pub use path::Path; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.