Debian Codegraph @

core/src/lib.rs

raw
1 // Copyright 2026 The Jujutsu Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 //! The core library powering the Jujutsu Version Control System. It contains
16 //! all "base" types such as `Commit` and the `Backend` trait.
17
18 #![warn(missing_docs)]
19 #![forbid(unsafe_code)]
20 #![deny(unused_must_use)]
21
22 // Needed so that proc macros can be used inside jj_core and by external crates
23 // that depend on it.
24 //
25 // See:
26 // - https://github.com/rust-lang/rust/issues/54647#issuecomment-432015102
27 // - https://github.com/rust-lang/rust/issues/54363
28 extern crate self as jj_core;
29
30 pub mod conflict_labels;
31 pub mod content_hash;
32 pub mod dag_walk;
33 pub mod dag_walk_async;
34 pub mod diff;
35 pub mod file_util;
36 pub mod graph;
37 pub mod hex_util;
38 pub mod matchers;
39 pub mod merge;
40 pub mod object_id;
41 pub mod ref_name;
42 pub mod repo_path;
43 pub mod str_util;
44 pub mod symbol_util;
45
46 #[cfg(test)]
47 mod tests {
48 use tempfile::TempDir;
49
50 // Copied from `testutils::TestResult` to remove dependency cycle.
51 pub type TestResult<T = ()> = eyre::Result<T>;
52
53 /// Unlike `testutils::new_temp_dir()`, this function doesn't set up
54 /// hermetic Git environment.
55 pub fn new_temp_dir() -> TempDir {
56 tempfile::Builder::new()
57 .prefix("jj-test-")
58 .tempdir()
59 .unwrap()
60 }
61 }