rust-pyo3-revlog: config extraction functions
We put this aside in a separate submodule to avoid cluttering
the main `revlog` module.
We use two helpers to extract items from the passed Python
configuration: an extension trait for `PyDict` and a macro.
As the macro uses `intern!`, it might make a small
differences if lots of revlogs have to be opened.
Also, using `conf` in namings instead of `py_config` in most cases, as the
fact that this is Python configuration is obvious from the context
(name of the module) and the types. This allows to let many item extractions
fit into a single line.
// revlog.rs
//
// Copyright 2019-2020 Georges Racinet <georges.racinet@octobus.net>
// 2020-2024 Raphaël Gomès <raphael.gomes@octobus.net>
// 2024 Georges Racinet <georges.racinet@cloudcrane.io>
//
// This software may be used and distributed according to the terms of the
// GNU General Public License version 2 or any later version.
use pyo3::prelude::*;
use crate::util::new_submodule;
mod config;
pub fn init_module<'py>(
py: Python<'py>,
package: &str,
) -> PyResult<Bound<'py, PyModule>> {
let m = new_submodule(py, package, "revlog")?;
Ok(m)
}