From aefc1b1a682c9fcb870a03849240dd8f17348cd5 Mon Sep 17 00:00:00 2001 From: Fedor Gogolev Date: Mon, 18 Apr 2016 11:13:20 +0300 Subject: [PATCH 1/2] Make struct generated with py_class! public --- src/py_class/py_class_impl.py | 2 +- src/py_class/py_class_impl.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/py_class/py_class_impl.py b/src/py_class/py_class_impl.py index 6eefbbfa..d10f4282 100644 --- a/src/py_class/py_class_impl.py +++ b/src/py_class/py_class_impl.py @@ -45,7 +45,7 @@ } $slots:tt { $( $imp:item )* } $members:tt; } => { - struct $class { _unsafe_inner: $crate::PyObject } + pub struct $class { _unsafe_inner: $crate::PyObject } pyobject_to_pyobject!($class); diff --git a/src/py_class/py_class_impl.rs b/src/py_class/py_class_impl.rs index 64bfb1a4..4c5733e7 100644 --- a/src/py_class/py_class_impl.rs +++ b/src/py_class/py_class_impl.rs @@ -39,7 +39,7 @@ macro_rules! py_class_impl { } $slots:tt { $( $imp:item )* } $members:tt; } => { - struct $class { _unsafe_inner: $crate::PyObject } + pub struct $class { _unsafe_inner: $crate::PyObject } pyobject_to_pyobject!($class); From bd7e4dfd9f2e288e4f5f01f93fe030f1cb21fc1e Mon Sep 17 00:00:00 2001 From: Fedor Gogolev Date: Mon, 18 Apr 2016 11:21:02 +0300 Subject: [PATCH 2/2] Fix tests for aefc1b1a682c9fcb870a03849240dd8f17348cd5 Make private type in tests public --- extensions/btree.rs | 2 +- tests/test_class.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/btree.rs b/extensions/btree.rs index 2c11e10a..86366be2 100644 --- a/extensions/btree.rs +++ b/extensions/btree.rs @@ -14,7 +14,7 @@ py_module_initializer!(btree, initbtree, PyInit_btree, |py, m| { /// Newtype around PyObject that implements Ord using python value comparisons. /// Python exceptions are converted into Rust panics. -struct OrdPyObject(PyObject); +pub struct OrdPyObject(PyObject); impl PartialEq for OrdPyObject { fn eq(&self, _other: &Self) -> bool { diff --git a/tests/test_class.rs b/tests/test_class.rs index 2b7c429a..01d20dc9 100644 --- a/tests/test_class.rs +++ b/tests/test_class.rs @@ -87,7 +87,7 @@ fn new_with_two_args() { assert_eq!(*obj._data2(py), 20); } -struct TestDropCall { +pub struct TestDropCall { drop_called: Arc } impl Drop for TestDropCall {