MCPcopy Index your code
hub / github.com/davidhewitt/pythonize / PythonizeMappingType

Interface PythonizeMappingType

src/ser.rs:15–31  ·  view source on GitHub ↗

Trait for types which can represent a Python mapping

Source from the content-addressed store, hash-verified

13
14/// Trait for types which can represent a Python mapping
15pub trait PythonizeMappingType {
16 /// Builder type for Python mappings
17 type Builder<'py>: 'py;
18
19 /// Create a builder for a Python mapping
20 fn builder<'py>(py: Python<'py>, len: Option<usize>) -> PyResult<Self::Builder<'py>>;
21
22 /// Adds the key-value item to the mapping being built
23 fn push_item<'py>(
24 builder: &mut Self::Builder<'py>,
25 key: Bound<'py, PyAny>,
26 value: Bound<'py, PyAny>,
27 ) -> PyResult<()>;
28
29 /// Build the Python mapping
30 fn finish<'py>(builder: Self::Builder<'py>) -> PyResult<Bound<'py, PyMapping>>;
31}
32
33/// Trait for types which can represent a Python mapping and have a name
34pub trait PythonizeNamedMappingType {

Callers

nothing calls this directly

Implementers 2

ser.rssrc/ser.rs
test_custom_types.rstests/test_custom_types.rs

Calls

no outgoing calls

Tested by

no test coverage detected