1- use async_tiff:: tiff :: Value ;
1+ use async_tiff:: TagValue ;
22use pyo3:: exceptions:: PyRuntimeError ;
33use pyo3:: prelude:: * ;
44use pyo3:: IntoPyObjectExt ;
55
6- pub struct PyValue ( Value ) ;
6+ pub struct PyValue ( TagValue ) ;
77
88impl < ' py > IntoPyObject < ' py > for PyValue {
99 type Target = PyAny ;
@@ -12,37 +12,39 @@ impl<'py> IntoPyObject<'py> for PyValue {
1212
1313 fn into_pyobject ( self , py : Python < ' py > ) -> Result < Self :: Output , Self :: Error > {
1414 match self . 0 {
15- Value :: Byte ( val) => val. into_bound_py_any ( py) ,
16- Value :: Short ( val) => val. into_bound_py_any ( py) ,
17- Value :: SignedByte ( val) => val. into_bound_py_any ( py) ,
18- Value :: SignedShort ( val) => val. into_bound_py_any ( py) ,
19- Value :: Signed ( val) => val. into_bound_py_any ( py) ,
20- Value :: SignedBig ( val) => val. into_bound_py_any ( py) ,
21- Value :: Unsigned ( val) => val. into_bound_py_any ( py) ,
22- Value :: UnsignedBig ( val) => val. into_bound_py_any ( py) ,
23- Value :: Float ( val) => val. into_bound_py_any ( py) ,
24- Value :: Double ( val) => val. into_bound_py_any ( py) ,
25- Value :: List ( val) => val
15+ TagValue :: Byte ( val) => val. into_bound_py_any ( py) ,
16+ TagValue :: Short ( val) => val. into_bound_py_any ( py) ,
17+ TagValue :: SignedByte ( val) => val. into_bound_py_any ( py) ,
18+ TagValue :: SignedShort ( val) => val. into_bound_py_any ( py) ,
19+ TagValue :: Signed ( val) => val. into_bound_py_any ( py) ,
20+ TagValue :: SignedBig ( val) => val. into_bound_py_any ( py) ,
21+ TagValue :: Unsigned ( val) => val. into_bound_py_any ( py) ,
22+ TagValue :: UnsignedBig ( val) => val. into_bound_py_any ( py) ,
23+ TagValue :: Float ( val) => val. into_bound_py_any ( py) ,
24+ TagValue :: Double ( val) => val. into_bound_py_any ( py) ,
25+ TagValue :: List ( val) => val
2626 . into_iter ( )
2727 . map ( |v| PyValue ( v) . into_bound_py_any ( py) )
2828 . collect :: < PyResult < Vec < _ > > > ( ) ?
2929 . into_bound_py_any ( py) ,
30- Value :: Rational ( num, denom) => ( num, denom) . into_bound_py_any ( py) ,
31- Value :: RationalBig ( num, denom) => ( num, denom) . into_bound_py_any ( py) ,
32- Value :: SRational ( num, denom) => ( num, denom) . into_bound_py_any ( py) ,
33- Value :: SRationalBig ( num, denom) => ( num, denom) . into_bound_py_any ( py) ,
34- Value :: Ascii ( val) => val. into_bound_py_any ( py) ,
35- Value :: Ifd ( _val) => Err ( PyRuntimeError :: new_err ( "Unsupported value type 'Ifd'" ) ) ,
36- Value :: IfdBig ( _val) => Err ( PyRuntimeError :: new_err ( "Unsupported value type 'IfdBig'" ) ) ,
30+ TagValue :: Rational ( num, denom) => ( num, denom) . into_bound_py_any ( py) ,
31+ TagValue :: RationalBig ( num, denom) => ( num, denom) . into_bound_py_any ( py) ,
32+ TagValue :: SRational ( num, denom) => ( num, denom) . into_bound_py_any ( py) ,
33+ TagValue :: SRationalBig ( num, denom) => ( num, denom) . into_bound_py_any ( py) ,
34+ TagValue :: Ascii ( val) => val. into_bound_py_any ( py) ,
35+ TagValue :: Ifd ( _val) => Err ( PyRuntimeError :: new_err ( "Unsupported value type 'Ifd'" ) ) ,
36+ TagValue :: IfdBig ( _val) => {
37+ Err ( PyRuntimeError :: new_err ( "Unsupported value type 'IfdBig'" ) )
38+ }
3739 v => Err ( PyRuntimeError :: new_err ( format ! (
3840 "Unknown value type: {v:?}"
3941 ) ) ) ,
4042 }
4143 }
4244}
4345
44- impl From < Value > for PyValue {
45- fn from ( value : Value ) -> Self {
46+ impl From < TagValue > for PyValue {
47+ fn from ( value : TagValue ) -> Self {
4648 Self ( value)
4749 }
4850}
0 commit comments