Skip to main content

jj_core/
lib.rs

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
28extern crate self as jj_core;
29
30pub mod backend;
31pub mod conflict_labels;
32pub mod content_hash;
33pub mod dag_walk;
34pub mod dag_walk_async;
35pub mod diff;
36pub mod file_util;
37pub mod graph;
38pub mod hex_util;
39pub mod matchers;
40pub mod merge;
41pub mod object_id;
42pub mod op_store;
43pub mod ref_name;
44pub mod repo_path;
45pub mod signing;
46pub mod str_util;
47pub mod symbol_util;
48pub mod workspace_store;
49
50#[cfg(test)]
51mod tests {
52    use tempfile::TempDir;
53
54    // Copied from `testutils::TestResult` to remove dependency cycle.
55    pub type TestResult<T = ()> = eyre::Result<T>;
56
57    /// Unlike `testutils::new_temp_dir()`, this function doesn't set up
58    /// hermetic Git environment.
59    pub fn new_temp_dir() -> TempDir {
60        tempfile::Builder::new()
61            .prefix("jj-test-")
62            .tempdir()
63            .unwrap()
64    }
65}