pub struct LocalCallbackError { /* private fields */ }Expand description
An error raised by a callback written in another language.
Like Java’s java.lang runtime exceptions it sits beside KafkaException,
not below it, so Error::is_kafka_error
is false and the client wraps it exactly as Java wraps a listener’s
foreign Throwable: the rebalance-listener path builds
KafkaException("User rebalance callback throws an error") with this error
as its source, Java’s getCause().
The opaque pointer lets the binding swap the original
error back in: on receiving an error whose cause chain holds a
LocalCallbackError, it reads the pointer back. Rust never dereferences
the pointer. Built with new it does not own it either: the
binding keeps the object alive for as long as it may be read. Built by the
FFI with a release function, the error owns it: every clone shares it, and
the release function runs once, when the last copy drops, on whatever task
or thread drops it.
Implementations§
Source§impl LocalCallbackError
impl LocalCallbackError
Sourcepub fn new(message: impl Into<String>, opaque: *mut c_void) -> Self
pub fn new(message: impl Into<String>, opaque: *mut c_void) -> Self
Creates the error with the foreign error’s text and the binding’s opaque pointer to it, which the error does not own.
§Arguments
message- the foreign error’s text, for the client’s logsopaque- the binding’s pointer to the foreign error, never dereferenced by Rust
Trait Implementations§
Source§impl Clone for LocalCallbackError
impl Clone for LocalCallbackError
Source§impl Debug for LocalCallbackError
impl Debug for LocalCallbackError
Source§impl Display for LocalCallbackError
impl Display for LocalCallbackError
Source§impl Error for LocalCallbackError
impl Error for LocalCallbackError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()