serramatutu opened a new issue, #4667:
URL: https://github.com/apache/arrow-adbc/issues/4667
### What feature or improvement would you like to see?
## Problem
Currently the `adbc_core::Error` struct contains all the fields (message,
status, vendor code etc), and it is directly embedded in `adbc_core::Result`.
That means regardless of `sizeof!(T)`, `Result` is always at least
`sizeof!(Error)`, which is large.
This makes applications pay a lot of stack frame for the cold error handling
path since every `Result` is big.
## Solution
Change it to something like
```rust
pub struct Error(Box<ErrorInner>);
pub struct ErrorInner {
message: String,
// ...
}
impl Error {
pub fn message(&self) -> &str {
&self.0.message
}
// ....
}
```
Now `sizeof!(Error)` is effectively the size of a thin pointer (`usize`).
Note that this will be a massive breaking change since currently all the
fields in `Error` are `pub` so virtually everyone doing error handling based on
those public fields will need to change their code to use accessors instead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]