File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -1558,18 +1558,23 @@ impl PyObject {
1558
1558
}
1559
1559
1560
1560
pub fn payload < T : PyValue > ( & self ) -> Option < & T > {
1561
- let payload: & dyn Any = & self . payload ;
1562
- payload. downcast_ref ( )
1561
+ self . payload . as_any ( ) . downcast_ref ( )
1563
1562
}
1564
1563
}
1565
1564
1566
1565
pub trait PyValue : fmt:: Debug + ' static {
1567
1566
fn required_type ( ctx : & PyContext ) -> PyObjectRef ;
1568
1567
}
1569
1568
1570
- pub trait PyObjectPayload : Any + fmt:: Debug + ' static { }
1569
+ pub trait PyObjectPayload : Any + fmt:: Debug + ' static {
1570
+ fn as_any ( & self ) -> & dyn Any ;
1571
+ }
1571
1572
1572
- impl < T : PyValue + ' static > PyObjectPayload for T { }
1573
+ impl < T : PyValue + ' static > PyObjectPayload for T {
1574
+ fn as_any ( & self ) -> & dyn Any {
1575
+ self
1576
+ }
1577
+ }
1573
1578
1574
1579
impl FromPyObjectRef for PyRef < PyClass > {
1575
1580
fn from_pyobj ( obj : & PyObjectRef ) -> Self {
You can’t perform that action at this time.
0 commit comments