feat!: rename CorexError to MytheclipseError

Complete the mytheclipse rebranding: the public error type now uses the
mytheclipse name. Breaking API change (CorexError -> MytheclipseError),
hence the major version bump.

BREAKING CHANGE: CorexError is renamed to MytheclipseError.
This commit is contained in:
asepharyana
2026-08-28 17:26:18 +07:00
parent fa14529aa2
commit 7cdf52544c
4 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ async fn main() {
let sum_result = mytheclipse::compute(|| (1..=1_000u64).sum::<u64>()); let sum_result = mytheclipse::compute(|| (1..=1_000u64).sum::<u64>());
let panic_result: Result<u64, mytheclipse::CorexError> = mytheclipse::compute(|| { let panic_result: Result<u64, mytheclipse::MytheclipseError> = mytheclipse::compute(|| {
panic!("intentional panic to demonstrate isolation"); panic!("intentional panic to demonstrate isolation");
}); });
+6 -6
View File
@@ -3,12 +3,12 @@
use std::panic::{catch_unwind, AssertUnwindSafe}; use std::panic::{catch_unwind, AssertUnwindSafe};
use crate::context::context; use crate::context::context;
use crate::error::CorexError; use crate::error::MytheclipseError;
/// Runs `f` on the global compute thread pool and returns its result. /// Runs `f` on the global compute thread pool and returns its result.
/// ///
/// If `f` panics, the panic is caught and converted into /// If `f` panics, the panic is caught and converted into
/// [`CorexError::ComputePanic`] instead of unwinding across the pool /// [`MytheclipseError::ComputePanic`] instead of unwinding across the pool
/// boundary or poisoning the pool; subsequent calls to [`compute`] continue /// boundary or poisoning the pool; subsequent calls to [`compute`] continue
/// to work normally. /// to work normally.
/// ///
@@ -23,7 +23,7 @@ use crate::error::CorexError;
/// captured by mutable reference: if `f` panics partway through mutating a /// captured by mutable reference: if `f` panics partway through mutating a
/// captured `&mut T`, that `T` may be left in an inconsistent state from /// captured `&mut T`, that `T` may be left in an inconsistent state from
/// the caller's perspective. /// the caller's perspective.
pub fn compute<F, R>(f: F) -> Result<R, CorexError> pub fn compute<F, R>(f: F) -> Result<R, MytheclipseError>
where where
F: FnOnce() -> R + Send, F: FnOnce() -> R + Send,
R: Send, R: Send,
@@ -32,7 +32,7 @@ where
context() context()
.compute_pool .compute_pool
.install(move || catch_unwind(wrapped)) .install(move || catch_unwind(wrapped))
.map_err(|payload| CorexError::ComputePanic(panic_payload_to_string(payload))) .map_err(|payload| MytheclipseError::ComputePanic(panic_payload_to_string(payload)))
} }
fn panic_payload_to_string(payload: Box<dyn std::any::Any + Send>) -> String { fn panic_payload_to_string(payload: Box<dyn std::any::Any + Send>) -> String {
@@ -51,8 +51,8 @@ mod tests {
#[test] #[test]
fn compute_panic_is_isolated_and_pool_survives() { fn compute_panic_is_isolated_and_pool_survives() {
let panicked: Result<u32, CorexError> = compute(|| panic!("boom")); let panicked: Result<u32, MytheclipseError> = compute(|| panic!("boom"));
assert!(matches!(panicked, Err(CorexError::ComputePanic(_)))); assert!(matches!(panicked, Err(MytheclipseError::ComputePanic(_))));
let recovered = compute(|| 1 + 1); let recovered = compute(|| 1 + 1);
assert_eq!(recovered.unwrap(), 2); assert_eq!(recovered.unwrap(), 2);
+3 -3
View File
@@ -7,7 +7,7 @@
/// wildcard arm. /// wildcard arm.
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug)] #[derive(Debug)]
pub enum CorexError { pub enum MytheclipseError {
/// A closure submitted to [`crate::compute::compute`] panicked. /// A closure submitted to [`crate::compute::compute`] panicked.
/// ///
/// The contained string is a best-effort rendering of the panic /// The contained string is a best-effort rendering of the panic
@@ -15,7 +15,7 @@ pub enum CorexError {
ComputePanic(String), ComputePanic(String),
} }
impl std::fmt::Display for CorexError { impl std::fmt::Display for MytheclipseError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self { match self {
Self::ComputePanic(message) => { Self::ComputePanic(message) => {
@@ -25,4 +25,4 @@ impl std::fmt::Display for CorexError {
} }
} }
impl std::error::Error for CorexError {} impl std::error::Error for MytheclipseError {}
+1 -1
View File
@@ -30,7 +30,7 @@ pub mod bg;
pub use context::{context, EngineContext}; pub use context::{context, EngineContext};
#[cfg(feature = "compute")] #[cfg(feature = "compute")]
pub use error::CorexError; pub use error::MytheclipseError;
#[cfg(feature = "io")] #[cfg(feature = "io")]
pub use io::spawn_io; pub use io::spawn_io;