Mercurial > public > mercurial-scm > hg
view rust/hg-pyo3/src/lib.rs @ 52409:a642c0a3860f
rust-pyo3: conversion helpers for Revision objects
Although the PyO3 API is indeed nicer and has derive macros, we still need
the collection helpers. The `Result` issue is not very relevant any more,
however the checking of incoming revisions for Python definitely is.
author | Georges Racinet <georges.racinet@cloudcrane.io> |
---|---|
date | Sat, 30 Nov 2024 20:30:18 +0100 |
parents | 20c0472b2ab7 |
children | c2480ac4c5e2 |
line wrap: on
line source
use pyo3::prelude::*; mod dagops; mod exceptions; mod revision; mod util; #[pymodule] fn pyo3_rustext(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> { m.add( "__doc__", "Mercurial core concepts - Rust implementation exposed via PyO3", )?; // the module's __name__ is pyo3_rustext, not mercurial.pyo3_rustext // (at least at this point). let name: String = m.getattr("__name__")?.extract()?; let dotted_name = format!("mercurial.{}", name); m.add_submodule(&dagops::init_module(py, &dotted_name)?)?; m.add("GraphError", py.get_type::<exceptions::GraphError>())?; Ok(()) }