Skip to content

Commit 08d68b8

Browse files
impl IntoPyObject for PyUnicodeWriter
1 parent cc390b7 commit 08d68b8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/fmt.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use {
1212
crate::impl_::callback::WrappingCastTo,
1313
crate::py_result_ext::PyResultExt,
1414
crate::types::PyString,
15+
crate::IntoPyObject,
1516
crate::{ffi, Bound, PyErr, PyResult, Python},
1617
std::fmt,
1718
std::mem::ManuallyDrop,
@@ -114,6 +115,17 @@ impl Drop for PyUnicodeWriter {
114115
}
115116
}
116117

118+
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
119+
impl<'py> IntoPyObject<'py> for PyUnicodeWriter {
120+
type Target = PyString;
121+
type Output = Bound<'py, Self::Target>;
122+
type Error = PyErr;
123+
124+
fn into_pyobject(self, py: Python<'py>) -> PyResult<Bound<'py, PyString>> {
125+
self.into_py_string(py)
126+
}
127+
}
128+
117129
#[cfg(test)]
118130
mod tests {
119131
#[cfg(not(any(Py_LIMITED_API, PyPy)))]

0 commit comments

Comments
 (0)