qubit-dcl 0.2.3

Reusable double-checked lock executor for Rust lock abstractions
Documentation
/*******************************************************************************
 *
 *    Copyright (c) 2025 - 2026 Haixing Hu.
 *
 *    SPDX-License-Identifier: Apache-2.0
 *
 *    Licensed under the Apache License, Version 2.0.
 *
 ******************************************************************************/
// qubit-style: allow explicit-imports
#[cfg(test)]
mod tests {
    use qubit_dcl::double_checked::CallbackError;

    mod test_callback_error {
        use super::*;

        #[test]
        fn test_from_display_is_untyped() {
            let error = CallbackError::from_display("callback failed");

            assert_eq!(error.message(), "callback failed");
            assert_eq!(error.callback_type(), None);
            assert!(!error.is_typed());
        }

        #[test]
        fn test_with_type_records_callback_type() {
            let error = CallbackError::with_type("prepare", "callback failed");

            assert_eq!(error.message(), "callback failed");
            assert_eq!(error.callback_type(), Some("prepare"));
            assert!(error.is_typed());
        }
    }
}