feat: IntoPyObject implementations for arbitrary types

This commit is contained in:
2025-03-15 15:29:40 -04:00
parent 25f1554870
commit 70c2380d0c
4 changed files with 50 additions and 4 deletions

View File

@@ -4,12 +4,12 @@ use pyo3::prelude::*;
use super::{arbitrary::Arbitrary, map_key::MapKey};
#[derive(Debug, Clone, derive_more::From, derive_more::Into)]
#[derive(Debug, Clone, Default, derive_more::From, derive_more::Into, IntoPyObject)]
pub struct Map(pub BTreeMap<MapKey, Arbitrary>);
impl<'py> FromPyObject<'py> for Map {
fn extract_bound(ob: &Bound<'py, PyAny>) -> PyResult<Self> {
let inner: BTreeMap<MapKey, Arbitrary> = ob.extract()?;
let inner = ob.extract()?;
Ok(Self(inner))
}