Skip to content

Commit

Permalink
support Rust 1.70 as MSRV
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Feb 26, 2024
1 parent dacf569 commit c2e1832
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 5 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,43 @@ jobs:

- run: cargo test

test-msrv:
name: test MSRV

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: set up python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: resolve MSRV
id: resolve-msrv
run:
echo MSRV=`python -c 'import tomllib; print(tomllib.load(open("Cargo.toml", "rb"))["package"]["rust-version"])'` >> $GITHUB_OUTPUT

- name: install rust MSRV
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.resolve-msrv.outputs.MSRV }}

- name: cache rust
uses: Swatinem/rust-cache@v2

- run: pip install -r tests/requirements.txt

- run: pip install -e .
env:
RUST_BACKTRACE: 1

- run: pip freeze

- run: pytest

- run: cargo test

# test with a debug build as it picks up errors which optimised release builds do not
test-debug:
name: test-debug ${{ matrix.python-version }}
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ include = [
"!tests/.pytest_cache",
"!*.so",
]
rust-version = "1.70"

[dependencies]
pyo3 = { version = "0.20.2", features = ["generate-import-lib", "num-bigint"] }
Expand Down
10 changes: 5 additions & 5 deletions src/serializers/fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl GeneralFieldsSerializer {
}
}

pub fn main_to_python<'py>(
pub(crate) fn main_to_python<'py>(
&self,
py: Python<'py>,
main_iter: impl Iterator<Item = PyResult<(&'py PyAny, &'py PyAny)>>,
Expand Down Expand Up @@ -212,7 +212,7 @@ impl GeneralFieldsSerializer {
}
}

pub fn main_serde_serialize<'py, S: serde::ser::Serializer>(
pub(crate) fn main_serde_serialize<'py, S: serde::ser::Serializer>(
&self,
main_iter: impl Iterator<Item = PyResult<(&'py PyAny, &'py PyAny)>>,
expected_len: usize,
Expand Down Expand Up @@ -258,7 +258,7 @@ impl GeneralFieldsSerializer {
Ok(map)
}

pub fn add_computed_fields_python(
pub(crate) fn add_computed_fields_python(
&self,
model: Option<&PyAny>,
output_dict: &PyDict,
Expand All @@ -275,7 +275,7 @@ impl GeneralFieldsSerializer {
Ok(())
}

pub fn add_computed_fields_json<S: serde::ser::Serializer>(
pub(crate) fn add_computed_fields_json<S: serde::ser::Serializer>(
&self,
model: Option<&PyAny>,
map: &mut S::SerializeMap,
Expand All @@ -291,7 +291,7 @@ impl GeneralFieldsSerializer {
Ok(())
}

pub fn computed_field_count(&self) -> usize {
pub(crate) fn computed_field_count(&self) -> usize {
option_length!(self.computed_fields)
}
}
Expand Down

0 comments on commit c2e1832

Please sign in to comment.