alamb opened a new pull request, #7663:
URL: https://github.com/apache/arrow-rs/pull/7663

   # Which issue does this PR close?
   
   - Part of https://github.com/apache/arrow-rs/issues/6736
   
   # Rationale for this change
   
   While making documentation / examples for working with `Variant` in 
https://github.com/apache/arrow-rs/pull/7661, I found it was somewhat awkward 
to make `Variant` values directly from the metadata and value. Specifically you 
have to
   
   ```rust
   let metadata = [0x01, 0x00, 0x00];
   let value = [0x09, 0x48, 0x49];
   // parse the header metadata
   let metadata = VariantMetadata::try_new(&metadata).unwrap();
   // and only then can you make the Variant
   Variant::try_new(&metadata, &value).unwrap()
   ```
   
   I would really like to be able to create `Variant `directly from `metadata` 
and `value` without having to make a `VariantMetadata` structure
   
   # What changes are included in this PR?
   
   This PR proposes a small change to the API so creating a Variant now looks 
like:
   
   ```rust
   let metadata = [0x01, 0x00, 0x00];
   let value = [0x09, 0x48, 0x49];
   // You can now make the Variant directly from the metadata and value
   Variant::try_new(&metadata, &value).unwrap()
   ```
   
   
   # Are there any user-facing changes?
   Yes, the API for creating APIs is slightly different (and I think better)


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