From de9d760462a16856d71feeab12c92cf7a911a613 Mon Sep 17 00:00:00 2001 From: Luca Trevisani Date: Sun, 25 Jun 2023 20:40:51 +0200 Subject: [PATCH] Add conversions between Rust Path/PathBuf and Python str / pathlib.Path --- guide/src/conversions/tables.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/guide/src/conversions/tables.md b/guide/src/conversions/tables.md index 38ed27c1f1e..911a9869973 100644 --- a/guide/src/conversions/tables.md +++ b/guide/src/conversions/tables.md @@ -13,7 +13,7 @@ The table below contains the Python type and the corresponding function argument | Python | Rust | Rust (Python-native) | | ------------- |:-------------------------------:|:--------------------:| | `object` | - | `&PyAny` | -| `str` | `String`, `Cow`, `&str`, `OsString`, `PathBuf` | `&PyUnicode` | +| `str` | `String`, `Cow`, `&str`, `OsString`, `PathBuf`, `Path` | `&PyString`, `&PyUnicode` | | `bytes` | `Vec`, `&[u8]`, `Cow<[u8]>` | `&PyBytes` | | `bool` | `bool` | `&PyBool` | | `int` | Any integer type (`i32`, `u32`, `usize`, etc) | `&PyLong` | @@ -28,6 +28,7 @@ The table below contains the Python type and the corresponding function argument | `slice` | - | `&PySlice` | | `type` | - | `&PyType` | | `module` | - | `&PyModule` | +| `pathlib.Path` | `PathBuf`, `Path` | `&PyString`, `&PyUnicode` | | `datetime.datetime` | - | `&PyDateTime` | | `datetime.date` | - | `&PyDate` | | `datetime.time` | - | `&PyTime` |