summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Oram <dev@mitmaro.ca>2024-02-11 10:37:43 -0330
committerTim Oram <dev@mitmaro.ca>2024-02-15 20:27:06 -0330
commit88ed84f466200af2c0536d04d85beaff96d165a5 (patch)
tree694c5d924bb2f11bf65f6a7e7f657843809ce0d2
parent1773de0e89526875503aa4a26a78adbeea8e9348 (diff)
Move runtime crate to core
-rw-r--r--Cargo.lock13
-rw-r--r--Cargo.toml1
-rw-r--r--src/core/Cargo.toml1
-rw-r--r--src/core/src/application.rs4
-rw-r--r--src/core/src/input/thread.rs16
-rw-r--r--src/core/src/lib.rs1
-rw-r--r--src/core/src/process.rs6
-rw-r--r--src/core/src/process/tests.rs2
-rw-r--r--src/core/src/process/thread.rs5
-rw-r--r--src/core/src/runtime.rs30
-rw-r--r--src/core/src/runtime/errors.rs (renamed from src/runtime/src/errors.rs)2
-rw-r--r--src/core/src/runtime/installer.rs (renamed from src/runtime/src/installer.rs)8
-rw-r--r--src/core/src/runtime/notifier.rs (renamed from src/runtime/src/notifier.rs)18
-rw-r--r--src/core/src/runtime/runtime.rs (renamed from src/runtime/src/runtime.rs)12
-rw-r--r--src/core/src/runtime/status.rs (renamed from src/runtime/src/status.rs)4
-rw-r--r--src/core/src/runtime/testutils.rs (renamed from src/runtime/src/testutils.rs)26
-rw-r--r--src/core/src/runtime/thread_statuses.rs (renamed from src/runtime/src/thread_statuses.rs)8
-rw-r--r--src/core/src/runtime/threadable.rs (renamed from src/runtime/src/threadable.rs)4
-rw-r--r--src/core/src/search/thread.rs22
-rw-r--r--src/core/src/testutil/process_test.rs2
-rw-r--r--src/core/src/view/thread.rs8
-rw-r--r--src/runtime/Cargo.toml27
-rw-r--r--src/runtime/Makefile.toml2
-rw-r--r--src/runtime/build.rs11
-rw-r--r--src/runtime/src/lib.rs153
25 files changed, 110 insertions, 276 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 8902034..993b458 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -332,7 +332,6 @@ dependencies = [
"claims",
"crossbeam-channel",
"crossterm",
- "girt-runtime",
"girt-testutils",
"git2",
"if_chain",
@@ -356,18 +355,6 @@ dependencies = [
]
[[package]]
-name = "girt-runtime"
-version = "2.3.0"
-dependencies = [
- "claims",
- "crossbeam-channel",
- "girt-testutils",
- "parking_lot",
- "rustc_version",
- "thiserror",
-]
-
-[[package]]
name = "girt-testutils"
version = "2.3.0"
dependencies = [
diff --git a/Cargo.toml b/Cargo.toml
index 99a93cc..350f180 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -26,7 +26,6 @@ path = "src/main.rs"
[workspace]
members = [
"src/core",
- "src/runtime",
"src/testutils",
]
diff --git a/src/core/Cargo.toml b/src/core/Cargo.toml
index 234ed81..7215a53 100644
--- a/src/core/Cargo.toml
+++ b/src/core/Cargo.toml
@@ -33,7 +33,6 @@ unicode-width = "0.1.10"
uuid = { version = "1.4.1", features = ["v4", "fast-rng"] }
version-track = "0.1.0"
xi-unicode = "0.3.0"
-girt-runtime = {version = "2.3.0", path = "../runtime"}
[target.'cfg(target_os = "macos")'.dependencies]
crossterm = { version = "0.26.1", features = ["use-dev-tty"] }
diff --git a/src/core/src/application.rs b/src/core/src/application.rs
index 647f977..119d220 100644
--- a/src/core/src/application.rs
+++ b/src/core/src/application.rs
@@ -2,7 +2,6 @@ use std::sync::Arc;
use anyhow::Result;
use parking_lot::Mutex;
-use runtime::{Runtime, ThreadStatuses, Threadable};
use crate::{
config::Config,
@@ -14,6 +13,7 @@ use crate::{
input::{Event, EventHandler, EventReaderFn},
module::{self, ExitStatus, ModuleHandler},
process::{self, Process},
+ runtime::{Runtime, ThreadStatuses, Threadable},
search,
search::UpdateHandlerFn,
todo_file::{TodoFile, TodoFileOptions},
@@ -193,7 +193,6 @@ mod tests {
use std::ffi::OsString;
use claims::{assert_none, assert_ok};
- use runtime::{Installer, RuntimeError};
use super::*;
use crate::{
@@ -201,6 +200,7 @@ mod tests {
events::Event,
input::{KeyCode, KeyEvent, KeyModifiers},
module::Modules,
+ runtime::{Installer, RuntimeError},
testutil::{create_event_reader, set_git_directory, DefaultTestModule, TestModuleProvider},
};
diff --git a/src/core/src/input/thread.rs b/src/core/src/input/thread.rs
index ddce68b..e9d647b 100644
--- a/src/core/src/input/thread.rs
+++ b/src/core/src/input/thread.rs
@@ -7,10 +7,12 @@ use std::{
};
use captur::capture;
-use runtime::{Installer, Threadable};
pub(crate) use state::State;
-use crate::input::{event::Event, event_provider::EventReaderFn};
+use crate::{
+ input::{event::Event, event_provider::EventReaderFn},
+ runtime::{Installer, Threadable},
+};
/// The name of the input thread.
pub(crate) const THREAD_NAME: &str = "input";
@@ -102,12 +104,14 @@ where
mod tests {
use anyhow::anyhow;
use crossterm::event::{KeyCode, KeyModifiers};
- use runtime::{testutils::ThreadableTester, Status};
use super::*;
- use crate::input::{
- testutil::local::{create_event_reader, TestEvent},
- KeyEvent,
+ use crate::{
+ input::{
+ testutil::local::{create_event_reader, TestEvent},
+ KeyEvent,
+ },
+ runtime::{testutils::ThreadableTester, Status},
};
#[test]
diff --git a/src/core/src/lib.rs b/src/core/src/lib.rs
index a8c546a..69bf443 100644
--- a/src/core/src/lib.rs
+++ b/src/core/src/lib.rs
@@ -147,6 +147,7 @@ mod license;
mod module;
mod modules;
mod process;
+mod runtime;
mod search;
#[cfg(test)]
mod tests;
diff --git a/src/core/src/process.rs b/src/core/src/process.rs
index 5cbaa85..cbfc885 100644
--- a/src/core/src/process.rs
+++ b/src/core/src/process.rs
@@ -15,7 +15,6 @@ use std::{
use anyhow::{anyhow, Error, Result};
use parking_lot::Mutex;
-use runtime::ThreadStatuses;
pub(crate) use self::{artifact::Artifact, results::Results, thread::Thread};
use crate::{
@@ -24,6 +23,7 @@ use crate::{
events::{Event, MetaEvent},
input::StandardEvent,
module::{self, ExitStatus, ModuleHandler, State},
+ runtime::ThreadStatuses,
search::{self, Action, Searchable},
todo_file::TodoFile,
view::{RenderContext, State as ViewState},
@@ -237,9 +237,9 @@ impl<ModuleProvider: module::ModuleProvider> Process<ModuleProvider> {
self.input_state.pause();
self.thread_statuses
- .wait_for_status(crate::view::REFRESH_THREAD_NAME, &runtime::Status::Waiting)?;
+ .wait_for_status(crate::view::REFRESH_THREAD_NAME, &crate::runtime::Status::Waiting)?;
self.thread_statuses
- .wait_for_status(crate::input::THREAD_NAME, &runtime::Status::Waiting)?;
+ .wait_for_status(crate::input::THREAD_NAME, &crate::runtime::Status::Waiting)?;
let mut cmd = Command::new(external_command.0.clone());
_ = cmd.args(external_command.1.clone());
diff --git a/src/core/src/process/tests.rs b/src/core/src/process/tests.rs
index 2da9d95..cc04b2c 100644
--- a/src/core/src/process/tests.rs
+++ b/src/core/src/process/tests.rs
@@ -1,7 +1,6 @@
use std::path::Path;
use anyhow::anyhow;
-use runtime::{testutils::MockNotifier, Status};
use super::*;
use crate::{
@@ -9,6 +8,7 @@ use crate::{
events::KeyBindings,
input::InputOptions,
module::{Module, DEFAULT_INPUT_OPTIONS, DEFAULT_VIEW_DATA},
+ runtime::{testutils::MockNotifier, Status},
search::{Interrupter, SearchResult},
testutil::{
create_default_test_module_handler,
diff --git a/src/core/src/process/thread.rs b/src/core/src/process/thread.rs
index 3f5bbb5..749405b 100644
--- a/src/core/src/process/thread.rs
+++ b/src/core/src/process/thread.rs
@@ -1,12 +1,12 @@
use std::sync::Arc;
use captur::capture;
-use runtime::{Installer, RuntimeError, Threadable};
use crate::{
module,
module::{ExitStatus, State},
process::{Process, Results},
+ runtime::{Installer, RuntimeError, Threadable},
};
pub(crate) const THEAD_NAME: &str = "core_process";
@@ -74,13 +74,12 @@ mod tests {
sync::atomic::{AtomicBool, Ordering},
};
- use runtime::{testutils::ThreadableTester, Status};
-
use super::*;
use crate::{
events::Event,
input::StandardEvent,
module::Module,
+ runtime::{testutils::ThreadableTester, Status},
testutil::{create_default_test_module_handler, create_test_module_handler, process_test, ProcessTestContext},
};
diff --git a/src/core/src/runtime.rs b/src/core/src/runtime.rs
new file mode 100644
index 0000000..331dbbb
--- /dev/null
+++ b/src/core/src/runtime.rs
@@ -0,0 +1,30 @@
+//! Git Interactive Rebase Tool - Runtime
+//!
+//! # Description
+//! This module is used to handle the application lifecycles and management of threads.
+//!
+//! ## Test Utilities
+//! To facilitate testing the usages of this crate, a set of testing utilities are provided. Since
+//! these utilities are not tested, and often are optimized for developer experience than
+//! performance should only be used in test code.
+
+mod errors;
+mod installer;
+mod notifier;
+#[allow(clippy::module_inception)]
+mod runtime;
+mod status;
+#[cfg(test)]
+pub(crate) mod testutils;
+mod thread_statuses;
+mod threadable;
+
+pub(crate) use crate::runtime::{
+ errors::RuntimeError,
+ installer::Installer,
+ notifier::Notifier,
+ runtime::Runtime,
+ status::Status,
+ thread_statuses::ThreadStatuses,
+ threadable::Threadable,
+};
diff --git a/src/runtime/src/errors.rs b/src/core/src/runtime/errors.rs
index a796b84..897f5ea 100644
--- a/src/runtime/src/errors.rs
+++ b/src/core/src/runtime/errors.rs
@@ -8,7 +8,7 @@ use thiserror::Error;
/// The kind of config error that occurred.
#[derive(Error, Debug, PartialEq, Eq)]
#[non_exhaustive]
-pub enum RuntimeError {
+pub(crate) enum RuntimeError {
/// An error occurred while attempting to spawn a thread
#[error("An error occurred while attempting to spawn thread: {0}")]
ThreadSpawnError(String),
diff --git a/src/runtime/src/installer.rs b/src/core/src/runtime/installer.rs
index fc5fd29..780730b 100644
--- a/src/runtime/src/installer.rs
+++ b/src/core/src/runtime/installer.rs
@@ -6,10 +6,10 @@ use std::{
use crossbeam_channel::Sender;
-use crate::{Notifier, Status, ThreadStatuses};
+use crate::runtime::{Notifier, Status, ThreadStatuses};
/// A thread installer that is passed to a `Threadable` when installing the threads into the `Runtime`
-pub struct Installer {
+pub(crate) struct Installer {
sender: Sender<(String, Status)>,
thread_statuses: ThreadStatuses,
ops: RefCell<HashMap<String, Box<dyn FnOnce() + Send>>>,
@@ -31,7 +31,7 @@ impl Installer {
/// Spawn a new thread with a name. The installer function callback will be called with a `Notifier` and is
/// returns the thread function.
#[inline]
- pub fn spawn<InstallFn, ThreadFn>(&self, name: &str, install: InstallFn)
+ pub(crate) fn spawn<InstallFn, ThreadFn>(&self, name: &str, install: InstallFn)
where
InstallFn: FnOnce(Notifier) -> ThreadFn,
ThreadFn: FnOnce() + Send + 'static,
@@ -66,7 +66,7 @@ mod tests {
use crossbeam_channel::unbounded;
use super::*;
- use crate::Threadable;
+ use crate::runtime::Threadable;
struct Thread {
called: Arc<AtomicBool>,
diff --git a/src/runtime/src/notifier.rs b/src/core/src/runtime/notifier.rs
index 72211a2..5714e8f 100644
--- a/src/runtime/src/notifier.rs
+++ b/src/core/src/runtime/notifier.rs
@@ -1,10 +1,10 @@
use crossbeam_channel::Sender;
-use crate::{status::Status, RuntimeError};
+use crate::runtime::{status::Status, RuntimeError};
/// A thread status notifier, that allows a thread to notify the `Runtime` of the current status of the thread.
#[derive(Debug)]
-pub struct Notifier {
+pub(crate) struct Notifier {
thread_name: String,
sender: Sender<(String, Status)>,
}
@@ -20,7 +20,7 @@ impl Notifier {
/// Notify the `Runtime` that the thread is busy processing.
#[inline]
#[allow(clippy::missing_panics_doc)]
- pub fn busy(&self) {
+ pub(crate) fn busy(&self) {
self.sender
.send((String::from(&self.thread_name), Status::Busy))
.unwrap();
@@ -29,7 +29,7 @@ impl Notifier {
/// Notify the `Runtime` to request that the `Runtime` and all other registered thread pause processing.
#[inline]
#[allow(clippy::missing_panics_doc)]
- pub fn request_pause(&self) {
+ pub(crate) fn request_pause(&self) {
self.sender
.send((String::from(&self.thread_name), Status::RequestPause))
.unwrap();
@@ -38,7 +38,7 @@ impl Notifier {
/// Notify the `Runtime` to request that the `Runtime` and all other registered thread resume processing.
#[inline]
#[allow(clippy::missing_panics_doc)]
- pub fn request_resume(&self) {
+ pub(crate) fn request_resume(&self) {
self.sender
.send((String::from(&self.thread_name), Status::RequestResume))
.unwrap();
@@ -47,7 +47,7 @@ impl Notifier {
/// Notify the `Runtime` to request that the `Runtime` and all other registered thread end processing.
#[inline]
#[allow(clippy::missing_panics_doc)]
- pub fn request_end(&self) {
+ pub(crate) fn request_end(&self) {
self.sender
.send((String::from(&self.thread_name), Status::RequestEnd))
.unwrap();
@@ -56,7 +56,7 @@ impl Notifier {
/// Notify the `Runtime` that the thread is waiting for new data or messages to process.
#[inline]
#[allow(clippy::missing_panics_doc)]
- pub fn wait(&self) {
+ pub(crate) fn wait(&self) {
self.sender
.send((String::from(&self.thread_name), Status::Waiting))
.unwrap();
@@ -65,7 +65,7 @@ impl Notifier {
/// Notify the `Runtime` that the thread is in a permanent error state.
#[inline]
#[allow(clippy::missing_panics_doc)]
- pub fn error(&self, err: RuntimeError) {
+ pub(crate) fn error(&self, err: RuntimeError) {
self.sender
.send((String::from(&self.thread_name), Status::Error(err)))
.unwrap();
@@ -74,7 +74,7 @@ impl Notifier {
/// Notify the `Runtime` that the thread has ended processing.
#[inline]
#[allow(clippy::missing_panics_doc)]
- pub fn end(&self) {
+ pub(crate) fn end(&self) {
self.sender
.send((String::from(&self.thread_name), Status::Ended))
.unwrap();
diff --git a/src/runtime/src/runtime.rs b/src/core/src/runtime/runtime.rs
index 61e9969..3e252c9 100644
--- a/src/runtime/src/runtime.rs
+++ b/src/core/src/runtime/runtime.rs
@@ -3,14 +3,14 @@ use std::{clone::Clone, sync::Arc, thread};
use crossbeam_channel::{unbounded, Receiver, Sender};
use parking_lot::Mutex;
-use crate::{Installer, RuntimeError, Status, ThreadStatuses, Threadable};
+use crate::runtime::{Installer, RuntimeError, Status, ThreadStatuses, Threadable};
const RUNTIME_THREAD_NAME: &str = "runtime";
/// A system the manages the lifetime of threads. This includes ensuring errors are handled, threads are paused and
/// resumed on request and that once the main application is completed, all threads complete and end.
#[allow(missing_debug_implementations)]
-pub struct Runtime<'runtime> {
+pub(crate) struct Runtime<'runtime> {
receiver: Receiver<(String, Status)>,
sender: Sender<(String, Status)>,
thread_statuses: ThreadStatuses,
@@ -21,7 +21,7 @@ impl<'runtime> Runtime<'runtime> {
/// Create a new instances of the `Runtime`.
#[inline]
#[must_use]
- pub fn new(thread_statuses: ThreadStatuses) -> Self {
+ pub(crate) fn new(thread_statuses: ThreadStatuses) -> Self {
let (sender, receiver) = unbounded();
thread_statuses.register_thread(RUNTIME_THREAD_NAME, Status::Waiting);
@@ -37,13 +37,13 @@ impl<'runtime> Runtime<'runtime> {
/// Get a cloned copy of the `ThreadStatuses`.
#[inline]
#[must_use]
- pub fn statuses(&self) -> ThreadStatuses {
+ pub(crate) fn statuses(&self) -> ThreadStatuses {
self.thread_statuses.clone()
}
/// Register a new `Threadable`.
#[inline]
- pub fn register(&self, threadable: &'runtime mut (dyn Threadable)) {
+ pub(crate) fn register(&self, threadable: &'runtime mut (dyn Threadable)) {
self.threadables.lock().push(threadable);
}
@@ -53,7 +53,7 @@ impl<'runtime> Runtime<'runtime> {
/// Returns and error if any of the threads registered to the runtime produce an error.
#[inline]
#[allow(clippy::iter_over_hash_type)]
- pub fn join(&self) -> Result<(), RuntimeError> {
+ pub(crate) fn join(&self) -> Result<(), RuntimeError> {
let installer = Installer::new(self.thread_statuses.clone(), self.sender.clone());
{
let threadables = self.threadables.lock();
diff --git a/src/runtime/src/status.rs b/src/core/src/runtime/status.rs
index 4624ba7..a73a142 100644
--- a/src/runtime/src/status.rs
+++ b/src/core/src/runtime/status.rs
@@ -1,10 +1,10 @@
-use crate::RuntimeError;
+use crate::runtime::RuntimeError;
/// The threads status.
#[derive(Debug, PartialEq, Eq)]
#[allow(variant_size_differences)]
#[allow(clippy::exhaustive_enums)]
-pub enum Status {
+pub(crate) enum Status {
/// Thread is new, and hasn't yet started. This is the initial status of all threads.
New,
/// The thread is busy processing.
diff --git a/src/runtime/src/testutils.rs b/src/core/src/runtime/testutils.rs
index b67e2ee..4ba361f 100644
--- a/src/runtime/src/testutils.rs
+++ b/src/core/src/runtime/testutils.rs
@@ -13,14 +13,14 @@ use std::{
use crossbeam_channel::{bounded, Receiver, Sender};
use parking_lot::Mutex;
-use crate::{Installer, Status, ThreadStatuses};
+use crate::runtime::{Installer, Status, ThreadStatuses};
const WAIT_TIME: Duration = Duration::from_millis(100);
/// A mocked version of the `Notifier`, that will interact directly with a `ThreadStatuses` without the use of a thread
/// or the `Runtime`.
#[derive(Debug)]
-pub struct MockNotifier<'notifier> {
+pub(crate) struct MockNotifier<'notifier> {
threadable_statuses: &'notifier ThreadStatuses,
}
@@ -28,20 +28,20 @@ impl<'notifier> MockNotifier<'notifier> {
/// Create a new instance of a `MockNotifier`.
#[inline]
#[must_use]
- pub const fn new(threadable_statuses: &'notifier ThreadStatuses) -> Self {
+ pub(crate) const fn new(threadable_statuses: &'notifier ThreadStatuses) -> Self {
Self { threadable_statuses }
}
/// Register a thread by name and status. This does not create a thread.
#[inline]
- pub fn register_thread(&mut self, thread_name: &str, status: Status) {
+ pub(crate) fn register_thread(&mut self, thread_name: &str, status: Status) {
self.threadable_statuses.register_thread(thread_name, status);
}
}
/// A tester utility for `Threadable`.
#[derive(Clone, Debug)]
-pub struct ThreadableTester {
+pub(crate) struct ThreadableTester {
receiver: Receiver<(String, Status)>,
sender: Sender<(String, Status)>,
statuses: Arc<Mutex<Vec<Status>>>,
@@ -52,7 +52,7 @@ impl ThreadableTester {
/// Create a new instance of the test utility.
#[inline]
#[must_use]
- pub fn new() -> Self {
+ pub(crate) fn new() -> Self {
let (sender, receiver) = bounded(0);
Self {
@@ -66,14 +66,18 @@ impl ThreadableTester {
/// Take the current `Status` changes.
#[inline]
#[must_use]
- pub fn take_statuses(&self) -> Vec<Status> {
+ pub(crate) fn take_statuses(&self) -> Vec<Status> {
mem::take(self.statuses.lock().borrow_mut())
}
/// Start a `Threadable` running the thread specified by the name, to completion in a separate thread.
#[inline]
#[allow(clippy::missing_panics_doc)]
- pub fn start_threadable<Threadable: crate::Threadable>(&self, theadable: &Threadable, thread_name: &str) {
+ pub(crate) fn start_threadable<Threadable: crate::runtime::Threadable>(
+ &self,
+ theadable: &Threadable,
+ thread_name: &str,
+ ) {
self.ended.store(false, Ordering::Release);
let installer = Installer::new(ThreadStatuses::new(), self.sender.clone());
theadable.install(&installer);
@@ -102,7 +106,7 @@ impl ThreadableTester {
///
/// Will panic if the wait takes too long and times out.
#[inline]
- pub fn wait_for_status(&self, status: &Status) {
+ pub(crate) fn wait_for_status(&self, status: &Status) {
let mut attempt = 0;
loop {
@@ -128,7 +132,7 @@ impl ThreadableTester {
///
/// Will panic if the wait takes too long and times out.
#[inline]
- pub fn wait_for_error_status(&self) {
+ pub(crate) fn wait_for_error_status(&self) {
let mut attempt = 0;
loop {
@@ -154,7 +158,7 @@ impl ThreadableTester {
///
/// Will panic if the wait takes too long and times out.
#[inline]
- pub fn wait_for_finished(&self) {
+ pub(crate) fn wait_for_finished(&self) {
let mut attempt = 0;
loop {
diff --git a/src/runtime/src/thread_statuses.rs b/src/core/src/runtime/thread_statuses.rs
index 9907f7b..87e275f 100644
--- a/src/runtime/src/thread_statuses.rs
+++ b/src/core/src/runtime/thread_statuses.rs
@@ -2,13 +2,13 @@ use std::{collections::HashMap, sync::Arc, thread::sleep, time::Duration};
use parking_lot::Mutex;
-use crate::{RuntimeError, Status};
+use crate::runtime::{RuntimeError, Status};
const WAIT_TIME: Duration = Duration::from_millis(100);
/// Tracker for threads current `Status`s.
#[derive(Debug, Clone)]
-pub struct ThreadStatuses {
+pub(crate) struct ThreadStatuses {
statuses: Arc<Mutex<HashMap<String, Status>>>,
}
@@ -16,7 +16,7 @@ impl ThreadStatuses {
/// Create a new instance.
#[must_use]
#[inline]
- pub fn new() -> Self {
+ pub(crate) fn new() -> Self {
Self {
statuses: Arc::new(Mutex::new(HashMap::new())),
}
@@ -27,7 +27,7 @@ impl ThreadStatuses {
/// # Errors
/// Will error if the wait times out.
#[inline]
- pub fn wait_for_status(&self, thread_name: &str, expected_status: &Status) -> Result<(), RuntimeError> {
+ pub(crate) fn wait_for_status(&self, thread_name: &str, expected_status: &Status) -> Result<(), RuntimeError> {
let mut attempt = 0;
loop {
diff --git a/src/runtime/src/threadable.rs b/src/core/src/runtime/threadable.rs
index 02f843f..e21e327 100644
--- a/src/runtime/src/threadable.rs
+++ b/src/core/src/runtime/threadable.rs
@@ -1,7 +1,7 @@
-use crate::installer::Installer;
+use crate::runtime::installer::Installer;
/// An interface for a entity that has threads managed by the `Runtime`.
-pub trait Threadable: Send {
+pub(crate) trait Threadable: Send {
/// Method that installs the threads that the `Threadable` is responsible for.
fn install(&self, installer: &Installer);
diff --git a/src/core/src/search/thread.rs b/src/core/src/search/thread.rs
index b0cd469..6c4ee9d 100644
--- a/src/core/src/search/thread.rs
+++ b/src/core/src/search/thread.rs
@@ -5,15 +5,17 @@ use std::{
};
use captur::capture;
-use runtime::{Installer, Threadable};
-
-use crate::search::{
- action::Action,
- interrupter::Interrupter,
- search_result::SearchResult,
- searchable::Searchable,
- State,
- UpdateHandlerFn,
+
+use crate::{
+ runtime::{Installer, Threadable},
+ search::{
+ action::Action,
+ interrupter::Interrupter,
+ search_result::SearchResult,
+ searchable::Searchable,
+ State,
+ UpdateHandlerFn,
+ },
};
pub(crate) const THREAD_NAME: &str = "search";
@@ -137,9 +139,9 @@ mod tests {
use std::sync::atomic::{AtomicUsize, Ordering};
use parking_lot::Mutex;
- use runtime::{testutils::ThreadableTester, Status};
use super::*;
+ use crate::runtime::{testutils::ThreadableTester, Status};
#[derive(Clone)]
struct MockedSearchable {
diff --git a/src/core/src/testutil/process_test.rs b/src/core/src/testutil/process_test.rs
index 0638d08..570eb7e 100644
--- a/src/core/src/testutil/process_test.rs
+++ b/src/core/src/testutil/process_test.rs
@@ -1,13 +1,13 @@
use std::{path::PathBuf, sync::Arc};
use parking_lot::Mutex;
-use runtime::ThreadStatuses;
use crate::{
display::Size,
events::Event,
module::{self, ModuleHandler},
process::Process,
+ runtime::ThreadStatuses,
testutil::{with_event_handler, with_search, EventHandlerTestContext, SearchTestContext},
todo_file::testutil::with_todo_file,
view::testutil::{with_view_state, TestContext as ViewContext},
diff --git a/src/core/src/view/thread.rs b/src/core/src/view/thread.rs
index 1da6e2c..d5f357c 100644
--- a/src/core/src/view/thread.rs
+++ b/src/core/src/view/thread.rs
@@ -9,11 +9,13 @@ use std::{
use captur::capture;
use parking_lot::Mutex;
-use runtime::{Installer, RuntimeError, Threadable};
pub(crate) use self::{action::ViewAction, state::State};
use super::View;
-use crate::display::Tui;
+use crate::{
+ display::Tui,
+ runtime::{Installer, RuntimeError, Threadable},
+};
/// The name of the main view thread.
pub(crate) const MAIN_THREAD_NAME: &str = "view_main";
@@ -162,7 +164,6 @@ mod tests {
use std::borrow::BorrowMut;
use claims::assert_ok;
- use runtime::{testutils::ThreadableTester, Status};
use super::*;
use crate::{
@@ -172,6 +173,7 @@ mod tests {
Display,
DisplayError,
},
+ runtime::{testutils::ThreadableTester, Status},
view::ViewData,
};
diff --git a/src/runtime/Cargo.toml b/src/runtime/Cargo.toml
deleted file mode 100644
index 3e1e315..0000000
--- a/src/runtime/Cargo.toml
+++ /dev/null
@@ -1,27 +0,0 @@
-[package]
-name = "girt-runtime"
-version = "2.3.0"
-authors = ["Tim Oram <dev@mitmaro.ca>"]
-license = "GPL-3.0-or-later"
-description = "Core modules for git-interactive-rebase-tool"
-homepage = "https://gitrebasetool.mitmaro.ca/"
-repository = "https://github.com/MitMaro/git-interactive-rebase-tool"
-edition = "2021"
-keywords = ["git", "cli"]
-categories = ["command-line-interface", "command-line-utilities", "text-editors"]
-readme = "../../README.md"
-
-[lib]
-name = "runtime"
-
-[dependencies]
-thiserror = "1.0.44"
-crossbeam-channel = "0.5.8"
-parking_lot = "0.12.1"
-
-[dev-dependencies]
-claims = "0.7.1"
-girt-testutils = {version = "2.3.0", path = "../testutils"}
-
-[build-dependencies]
-rustc_version = "0.4.0"
diff --git a/src/runtime/Makefile.toml b/src/runtime/Makefile.toml
deleted file mode 100644
index c19ab5c..0000000
--- a/src/runtime/Makefile.toml
+++ /dev/null
@@ -1,2 +0,0 @@
-extend = "../../Makefile.toml"
-
diff --git a/src/runtime/build.rs b/src/runtime/build.rs
deleted file mode 100644
index 4cc52ff..0000000
--- a/src/runtime/build.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-use rustc_version::{version_meta, Channel};
-
-fn main() {
- // allow unknown lints in nightly builds
- if let Ok(meta) = version_meta() {
- if meta.channel == Channel::Nightly {
- println!("cargo:rustc-cfg=allow_unknown_lints");
- println!("cargo:rustc-cfg=include_nightly_lints");
- }
- }
-}
diff --git a/src/runtime/src/lib.rs b/src/runtime/src/lib.rs
deleted file mode 100644
index b651219..0000000
--- a/src/runtime/src/lib.rs
+++ /dev/null
@@ -1,153 +0,0 @@
-// LINT-REPLACE-START
-// This section is autogenerated, do not modify directly
-// nightly sometimes removes/renames lints
-#![cfg_attr(allow_unknown_lints, allow(unknown_lints))]
-#![cfg_attr(allow_unknown_lints, allow(renamed_and_removed_lints))]
-// enable all rustc's built-in lints
-#![deny(
- future_incompatible,
- nonstandard_style,
- rust_2018_compatibility,
- rust_2018_idioms,
- rust_2021_compatibility,
- unused,
- warnings
-)]
-// rustc's additional allowed by default lints
-#![deny(
- absolute_paths_not_starting_with_crate,
- deprecated_in_future,
- elided_lifetimes_in_paths,
- explicit_outlives_requirements,
- ffi_unwind_calls,
- keyword_idents,
- let_underscore_drop,
- macro_use_extern_crate,
- meta_variable_misuse,
- missing_abi,
- missing_copy_implementations,
- missing_debug_implementations,
- missing_docs,
- non_ascii_idents,
- noop_method_call,
- pointer_structural_match,
- rust_2021_incompatible_closure_captures,
- rust_2021_incompatible_or_patterns,
- rust_2021_prefixes_incompatible_syntax,
- rust_2021_prelude_collisions,
- single_use_lifetimes,
- trivial_casts,
- trivial_numeric_casts,
- unreachable_pub,
- unsafe_code,
- unsafe_op_in_unsafe_fn,
-