2021-04-17 21:22:06 +00:00
|
|
|
#![deny(deprecated)]
|
2024-03-15 10:25:27 +00:00
|
|
|
#![allow(dead_code)]
|
2021-04-17 21:22:06 +00:00
|
|
|
|
|
|
|
use pyo3::prelude::*;
|
|
|
|
|
2022-10-25 06:23:21 +00:00
|
|
|
#[pyclass]
|
|
|
|
struct MyClass;
|
2021-04-17 21:22:06 +00:00
|
|
|
|
2023-10-05 22:59:03 +00:00
|
|
|
#[pymethods]
|
|
|
|
impl MyClass {
|
|
|
|
#[__new__]
|
|
|
|
fn new() -> Self {
|
|
|
|
Self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-13 07:19:43 +00:00
|
|
|
fn main() {}
|
2024-03-08 00:28:11 +00:00
|
|
|
|
2024-05-10 10:34:58 +00:00
|
|
|
fn extract_options(obj: &Bound<'_, PyAny>) -> PyResult<Option<i32>> {
|
|
|
|
obj.extract()
|
|
|
|
}
|
|
|
|
|
|
|
|
#[pyfunction]
|
|
|
|
#[pyo3(signature = (_i, _any=None))]
|
|
|
|
fn pyfunction_option_1(_i: u32, _any: Option<i32>) {}
|
|
|
|
|
|
|
|
#[pyfunction]
|
|
|
|
fn pyfunction_option_2(_i: u32, _any: Option<i32>) {}
|
|
|
|
|
|
|
|
#[pyfunction]
|
|
|
|
fn pyfunction_option_3(_i: u32, _any: Option<i32>, _foo: Option<String>) {}
|
|
|
|
|
|
|
|
#[pyfunction]
|
|
|
|
fn pyfunction_option_4(
|
|
|
|
_i: u32,
|
|
|
|
#[pyo3(from_py_with = "extract_options")] _any: Option<i32>,
|
|
|
|
_foo: Option<String>,
|
|
|
|
) {
|
|
|
|
}
|
|
|
|
|
2024-05-31 14:13:30 +00:00
|
|
|
#[pyclass]
|
|
|
|
pub enum SimpleEnumWithoutEq {
|
|
|
|
VariamtA,
|
|
|
|
VariantB,
|
|
|
|
}
|