Mercurial > public > mercurial-scm > hg
view rust/hg-core/src/dirstate.rs @ 52300:04b9a56c2d25
rust-lib: only export very common types to the top of the crate
This was done very early in the Rust project's lifecycle and I had very little
Rust experience. Let's keep the `DirstateParents` since they'll pop up in
all higher-level code and make the rest more explicit imports to make the
imports less confusing and the lib less cluttered.
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Mon, 04 Nov 2024 11:13:05 +0100 |
parents | b422acba55f1 |
children | 79e8118cd846 |
line wrap: on
line source
// dirstate module // // Copyright 2019 Raphaël Gomès <rgomes@octobus.net> // // This software may be used and distributed according to the terms of the // GNU General Public License version 2 or any later version. use crate::dirstate::on_disk::DirstateV2ParseError; use crate::revlog::node::NULL_NODE; use crate::revlog::Node; use crate::utils::hg_path::HgPath; use bytes_cast::BytesCast; use entry::DirstateEntry; pub mod dirs_multiset; pub mod dirstate_map; pub mod entry; pub mod on_disk; pub mod owning; pub mod parsers; pub mod path_with_basename; pub mod status; #[derive(Debug, PartialEq, Copy, Clone, BytesCast)] #[repr(C)] pub struct DirstateParents { pub p1: Node, pub p2: Node, } impl DirstateParents { pub const NULL: Self = Self { p1: NULL_NODE, p2: NULL_NODE, }; pub fn is_merge(&self) -> bool { !(self.p2 == NULL_NODE) } } pub type StateMapIter<'a> = Box< dyn Iterator< Item = Result<(&'a HgPath, DirstateEntry), DirstateV2ParseError>, > + Send + 'a, >; pub type CopyMapIter<'a> = Box< dyn Iterator<Item = Result<(&'a HgPath, &'a HgPath), DirstateV2ParseError>> + Send + 'a, >;