(
s: PyStrRef,
encoding: Option<PyUtf8StrRef>,
errors: Option<PyUtf8StrRef>,
vm: &VirtualMachine,
)
| 1655 | } |
| 1656 | |
| 1657 | pub(crate) fn encode_string( |
| 1658 | s: PyStrRef, |
| 1659 | encoding: Option<PyUtf8StrRef>, |
| 1660 | errors: Option<PyUtf8StrRef>, |
| 1661 | vm: &VirtualMachine, |
| 1662 | ) -> PyResult<PyBytesRef> { |
| 1663 | let encoding = match encoding.as_ref() { |
| 1664 | None => crate::codecs::DEFAULT_ENCODING, |
| 1665 | Some(s) => s.as_str(), |
| 1666 | }; |
| 1667 | vm.state.codec_registry.encode_text(s, encoding, errors, vm) |
| 1668 | } |
| 1669 | |
| 1670 | impl PyPayload for PyStr { |
| 1671 | #[inline] |
no test coverage detected