pub struct CallbackError { /* private fields */ }Expand description
Common error information for prepare lifecycle callbacks.
This keeps a semantic callback type label together with the message so callers can classify failures without depending on fragile string matching.
§Examples
use qubit_dcl::double_checked::CallbackError;
let prepare_error = CallbackError::with_callback_type("prepare", "Resource is locked");
assert_eq!(prepare_error.callback_type(), Some("prepare"));
println!("prepare_error = {:?}", prepare_error);Implementations§
Source§impl CallbackError
impl CallbackError
Sourcepub fn from_display<T: Display>(error: T) -> Self
pub fn from_display<T: Display>(error: T) -> Self
Sourcepub fn with_callback_type<T: Display>(
callback_type: &'static str,
error: T,
) -> Self
pub fn with_callback_type<T: Display>( callback_type: &'static str, error: T, ) -> Self
Builds a callback error with explicit callback type metadata.
§Parameters
callback_type- Semantic callback type label, such as"prepare"or"prepare_rollback".error- Error message or displayable error value produced by the callback.
§Returns
A callback error with callback_type stored as metadata.
Sourcepub fn callback_type(&self) -> Option<&'static str>
pub fn callback_type(&self) -> Option<&'static str>
Returns the callback type label, when available.
§Returns
Some(label) when this error was built with callback type metadata, or
None when no metadata is available.
Trait Implementations§
Source§impl Clone for CallbackError
impl Clone for CallbackError
Source§fn clone(&self) -> CallbackError
fn clone(&self) -> CallbackError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CallbackError
impl Debug for CallbackError
Auto Trait Implementations§
impl Freeze for CallbackError
impl RefUnwindSafe for CallbackError
impl Send for CallbackError
impl Sync for CallbackError
impl Unpin for CallbackError
impl UnsafeUnpin for CallbackError
impl UnwindSafe for CallbackError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more