Mercurial > public > mercurial-scm > hg-stable
view rust/hg-direct-ffi/src/lib.rs @ 40300:72b94f946e90
rust: rustlazyancestors.__contains__
This changeset provides a Rust implementation of
the iteration performed by lazyancestor.__contains__
It has the advantage over the Python iteration to use
the 'seen' set encapsuled into the dedicated iterator (self._containsiter),
rather than storing emitted items in another set (self._containsseen),
and hence should reduce the memory footprint.
Also, there's no need to convert intermediate emitted revisions back into
Python integers.
At this point, it would be tempting to implement the whole lazyancestor object
in Rust, but that would lead to more C wrapping code (two objects) for
little expected benefits.
author | Georges Racinet <gracinet@anybox.fr> |
---|---|
date | Mon, 08 Oct 2018 19:11:41 +0200 |
parents | a36c5e23c055 |
children |
line wrap: on
line source
// Copyright 2018 Georges Racinet <gracinet@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 exposes methods to build and use a `rustlazyancestors` iterator //! from C code, using an index and its parents function that are passed //! from the caller at instantiation. extern crate hg; extern crate libc; mod ancestors; pub use ancestors::{ rustlazyancestors_contains, rustlazyancestors_drop, rustlazyancestors_init, rustlazyancestors_next, };