bettermultiply opened a new issue, #7101:
URL: https://github.com/apache/opendal/issues/7101

   Hi, I am reading Opendal's C bindings(and hoping to do some contribute).
   
   I find that there are several codes share the same pattern:
   ```
   assert!(!scheme.is_null());
   let scheme = std::ffi::CStr::from_ptr(scheme)
       .to_str()
       .expect("malformed scheme");
   ```
   Is it better to encapsulate it into a function like `parse_c_string(*const 
c_char)` ? 
   
   And I notice that the panic generate from assert!() will be accross FFI 
boundaries which is undefined behavior(I see this in a post three years ago, I 
do not know whether it is still the truth). Is it good to use `assert!` here? 
or replace it with error, which can be caught by `opendal_error`. 
   
   Or the panic is just expected here for the error will only happen when 
developing and won't happen in production, so ruin the whole program is the 
best choice here?


-- 
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]

Reply via email to