[PATCH 2 of 5 RFC] rust: iterator bindings to C code

Augie Fackler raf at durin42.com
Wed Jan 16 05:13:51 EST 2019



> On Jan 16, 2019, at 11:13, Georges Racinet <georges.racinet at octobus.net> wrote:
> 
> Hi Augie,
> 
> On 10/1/18 5:02 PM, Augie Fackler wrote:
>> On Fri, Sep 28, 2018 at 03:31:09PM +0200, Georges Racinet wrote:
>>> # HG changeset patch
>>> # User Georges Racinet <gracinet at anybox.fr>
>>> # Date 1538059896 -7200
>>> #      Thu Sep 27 16:51:36 2018 +0200
>>> # Node ID de88c09512565ed1c12e2ff9159e06ed8d762d15
>>> # Parent  d8c9571755a64e1fc3429587dfd3949b9862eceb
>>> # EXP-Topic rustancestors-rfc
>>> rust: iterator bindings to C code
>>> 
>>> In this changeset, still made of Rust code only,
>>> we expose the Rust iterator for instantiation and
>>> consumption from C code.
>>> 
>>> The idea is that both the index and index_get_parents()
>>> will be passed from the C extension, hence avoiding a hard
>>> link dependency to parsers.so, so that the crate can
>>> still be built and tested independently.
>>> 
>>> On the other hand, parsers.so will use the symbols
>>> defined in this changeset.
>>> 
>>> diff -r d8c9571755a6 -r de88c0951256 mercurial/rust/Cargo.lock
>>> --- a/mercurial/rust/Cargo.lock	Thu Sep 27 17:03:16 2018 +0200
>>> +++ b/mercurial/rust/Cargo.lock	Thu Sep 27 16:51:36 2018 +0200
>>> @@ -1,4 +1,14 @@
>>> [[package]]
>>> name = "hgancestors"
>>> version = "0.1.0"
>>> +dependencies = [
>>> + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
>>> +]
>>> 
>>> +[[package]]
>>> +name = "libc"
>>> +version = "0.2.43"
>>> +source = "registry+https://github.com/rust-lang/crates.io-index"
>>> +
>>> +[metadata]
>>> +"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d"
>>> diff -r d8c9571755a6 -r de88c0951256 mercurial/rust/Cargo.toml
>>> --- a/mercurial/rust/Cargo.toml	Thu Sep 27 17:03:16 2018 +0200
>>> +++ b/mercurial/rust/Cargo.toml	Thu Sep 27 16:51:36 2018 +0200
>>> @@ -2,3 +2,9 @@
>>> name = "hgancestors"
>>> version = "0.1.0"
>>> authors = ["Georges Racinet <gracinet at anybox.fr>"]
>>> +
>>> +[dependencies]
>>> +libc = "*"
>>> +
>>> +[lib]
>>> +crate-type = ["dylib"]
>>> diff -r d8c9571755a6 -r de88c0951256 mercurial/rust/src/cpython.rs
>>> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
>>> +++ b/mercurial/rust/src/cpython.rs	Thu Sep 27 16:51:36 2018 +0200
>>> @@ -0,0 +1,170 @@
>>> +// Copyright 2018 Georges Racinet <gracinet at anybox.fr>
>>> +//
>>> +// This software may be used and distributed according to the terms of the
>>> +// GNU General Public License version 2 or any later version.
>>> +
>>> +//! Bindings for CPython extension code
>> This looks like you're using cffi and not cpython extension logic? I
>> don't see anything python-specific in here, so maybe this is misnamed?
> This patch is outdated, and the corresponding code has been moved during
> the October sprint in its own crate, rust/hg-direct-ffi, before Yuya
> queued it.

Ugh, I did something dumb on my laptop and a bunch of zombie messages got sent today. Sorry!



More information about the Mercurial-devel mailing list