silver-ymz commented on code in PR #3001:
URL:
https://github.com/apache/incubator-opendal/pull/3001#discussion_r1313704833
##########
bindings/cpp/src/lib.rs:
##########
@@ -27,12 +26,40 @@ mod ffi {
value: String,
}
+ struct Metadata {
+ // tag layout: (8 bits flagset)
+ // 0-1: mode, 2: has_cache_control, 3: has_content_disposition, 4:
has_content_md5,
+ // 5: has_content_type, 6: has_etag, 7: has_last_modified
+ //
+ // mode enum: (2 bits)
+ // 1: file, 2: dir, 0,3: unknown
+ tag: u8,
Review Comment:
`cxx` doesn't support generic type parameter, so we can't pass something
like `Option<T>` by value. To complete similar function, I come up with
following possible solutions:
- keep current impl, and wait https://github.com/dtolnay/cxx/issues/87 to
complete.
- copy the value into heap first, and store a pointer in `Option`. This is
the easiest way, but it will bring much excessive cost and lots of unsafe code.
- expose each specific struct for each type, like `struct
OptionalString(Option<String>)`. We can write a macro to reduce repeated code.
I prefer to wait upstream work. Because other ways may be unable to
integrate well with other `cxx` parts.
--
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]