flatbuffers icon indicating copy to clipboard operation
flatbuffers copied to clipboard

Rust full reflection

Open candysonya opened this issue 2 years ago • 7 comments

Compared to the C++ implementation of the reflection feature,

It includes:

  • Helper functions to access schema
  • Full reflection - getters for scalar/string/struct/table/vector types
  • Full reflection - setters for scalar/string types
  • Verification of buffer
  • Tests for above

It doesn't include:

  • Getter for VectorOfAny (Vector without element type specified)
  • Setter from another buffer, and converting buffer to builder

TODOs on C++ side are retained.

candysonya avatar Sep 26 '23 11:09 candysonya

@candysonya @dextero We are using flatbuffers at work and I have a small patch that allows us to have zero-allocation of flatbuffer messages. I noticed that this change makes all the &'static str into String. Is this strictly necessary? Could it be Cow<'static, str>?

adsnaider avatar Jan 05 '24 15:01 adsnaider

@candysonya @dextero We are using flatbuffers at work and I have a small patch that allows us to have zero-allocation of flatbuffer messages. I noticed that this change makes all the &'static str into String. Is this strictly necessary? Could it be Cow<'static, str>?

Thanks for pointing it out! I've just updated the change with Cow<'static, str>.

candysonya avatar Jan 08 '24 15:01 candysonya

Thank you for making the changes to Cow<'static, str>. This is an awesome patch set and I'm really excited to have reflection! My comments are a few cases where you used .to_string() but I believe that .into() should work instead to make the value into a Cow and not a String. I could be wrong though and in that case feel free to ignore my comments

Thanks so much for spotting that!

candysonya avatar Jan 17 '24 17:01 candysonya