Skip to content

Commit 390226b

Browse files
committed
support Rust 1.70 as MSRV
1 parent 47aff70 commit 390226b

File tree

3 files changed

+43
-5
lines changed

3 files changed

+43
-5
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,43 @@ jobs:
140140

141141
- run: cargo test
142142

143+
test-msrv:
144+
name: test MSRV
145+
146+
runs-on: ubuntu-latest
147+
steps:
148+
- uses: actions/checkout@v4
149+
150+
- name: set up python
151+
uses: actions/setup-python@v5
152+
with:
153+
python-version: '3.11'
154+
155+
- name: resolve MSRV
156+
id: resolve-msrv
157+
run:
158+
echo MSRV=`python -c 'import tomllib; print(tomllib.load(open("Cargo.toml", "rb"))["package"]["rust-version"])'` >> $GITHUB_OUTPUT
159+
160+
- name: install rust MSRV
161+
uses: dtolnay/rust-toolchain@master
162+
with:
163+
toolchain: ${{ steps.resolve-msrv.outputs.MSRV }}
164+
165+
- name: cache rust
166+
uses: Swatinem/rust-cache@v2
167+
168+
- run: pip install -r tests/requirements.txt
169+
170+
- run: pip install -e .
171+
env:
172+
RUST_BACKTRACE: 1
173+
174+
- run: pip freeze
175+
176+
- run: pytest
177+
178+
- run: cargo test
179+
143180
# test with a debug build as it picks up errors which optimised release builds do not
144181
test-debug:
145182
name: test-debug ${{ matrix.python-version }}

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ include = [
2424
"!tests/.pytest_cache",
2525
"!*.so",
2626
]
27+
rust-version = "1.70"
2728

2829
[dependencies]
2930
pyo3 = { version = "0.20.2", features = ["generate-import-lib", "num-bigint"] }

src/serializers/fields.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl GeneralFieldsSerializer {
147147
}
148148
}
149149

150-
pub fn main_to_python<'py>(
150+
pub(crate) fn main_to_python<'py>(
151151
&self,
152152
py: Python<'py>,
153153
main_iter: impl Iterator<Item = PyResult<(&'py PyAny, &'py PyAny)>>,
@@ -212,7 +212,7 @@ impl GeneralFieldsSerializer {
212212
}
213213
}
214214

215-
pub fn main_serde_serialize<'py, S: serde::ser::Serializer>(
215+
pub(crate) fn main_serde_serialize<'py, S: serde::ser::Serializer>(
216216
&self,
217217
main_iter: impl Iterator<Item = PyResult<(&'py PyAny, &'py PyAny)>>,
218218
expected_len: usize,
@@ -258,7 +258,7 @@ impl GeneralFieldsSerializer {
258258
Ok(map)
259259
}
260260

261-
pub fn add_computed_fields_python(
261+
pub(crate) fn add_computed_fields_python(
262262
&self,
263263
model: Option<&PyAny>,
264264
output_dict: &PyDict,
@@ -275,7 +275,7 @@ impl GeneralFieldsSerializer {
275275
Ok(())
276276
}
277277

278-
pub fn add_computed_fields_json<S: serde::ser::Serializer>(
278+
pub(crate) fn add_computed_fields_json<S: serde::ser::Serializer>(
279279
&self,
280280
model: Option<&PyAny>,
281281
map: &mut S::SerializeMap,
@@ -291,7 +291,7 @@ impl GeneralFieldsSerializer {
291291
Ok(())
292292
}
293293

294-
pub fn computed_field_count(&self) -> usize {
294+
pub(crate) fn computed_field_count(&self) -> usize {
295295
option_length!(self.computed_fields)
296296
}
297297
}

0 commit comments

Comments
 (0)