Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust support #1

Merged
merged 515 commits into from
Aug 21, 2017
Merged

Conversation

hollinwilkins
Copy link

@hollinwilkins hollinwilkins commented Aug 21, 2017

Hey @josephDunne, I wanted to help get this PR ready for merging into the google codebase. As a start, I fixed all of the merge conflicts with master. Next up, I need to make sure all of the codegen is still working as expected. Would it be possible for us to generate a TODO list that we can work down before Rust support is ready?

Thank you!

  • Hollin

Wouter van Oortmerssen and others added 30 commits October 17, 2016 10:46
Change-Id: I5f538d12ea37d11d2e239ddde32eefcdd91e347b
Tested: on Linux.
Tested on Linux.

Change-Id: Ie18d6857f9ae8b1c3953a116203b4a8bb70a2ede
Change-Id: I6d0e8469bfa5b4c8a3f1cb119e186f4cf62c76ae
Change-Id: Ia63e41d0304e8668ea4ce09a4c31dd999eb96994
Tested: on Linux.
Bug: 32218623
…or long default value (google#4051)

* Java: emit "signed" equivalent of unsigned default value in generated code and add "L" suffix to long default value.

* Updated generated code

* Only convert ulong to "signed" equivalent. ubyte and ushort don't need specific handling as "user facing" type is int. uint need 'L' suffix as "user facing" type is long.

* Added missing cast to primitive type of default value which is in "user facing" type in builder.add<type>() calls.

* Do not cast default value to actual type in C#.
* Make parameter order in jsdocs match function

When the order doesn't match the Google Closure Javascript compiler generates
warnings

* Prefix optional parameters with opt_

The Closure Compiler emits warnings when this isn't the case
Also fixed structs not being created inline in the tutorial,
which would actually have bad consequences if used.

Change-Id: Idce215c61a1b24a297cee76f625052bb2722e970
Change-Id: I06fb61edf018adf0f26a81de4596b4972226e466
Tested: on Android.
Bug: 30263829
Change-Id: Ib0b1692044f35e374a0f7c0359c94319f4a25619
Fixed generation of a trailing comma and removed unnecessary use of a lambda.

Change-Id: I9993f6eb83e2ebc36fc40295a2059c340c1fbe03
Tested: on Linux.
* chore(lint)

I accidentally let 2 pieces of lint in with my generated code.

* fix(generate-code): I did not generate all the required code for tests.
I've faced an issue where I want to serialize UTF-8 emojis and FlatBufferBuilder::is_utf8 would return false on them.
I was not able to add the corresponding hexadecimal code because I don't understand how the whole thing works but what i've done is using the `mb_detect_encoding` function which handles correctly all supposed UTF-8 characters.
Change-Id: I02b00b22cdd2d1bd32de3273ff69185c9b0f4e5b
Introduce a "native_inline" attribute that can be applied on fields that are structs.
This results in NativeTable code generation that sets the struct "inline" rather than
storing it in a pointer.

From cl/140527470.

Change-Id: I208724f552b8b921b20923e0bf82f42cb3582416
The following changes have been made to the C++ codegen to enable writing generic code
that uses the Table and NativeTable types.

- Adds TableType and NativeTableType typedefs to NativeTable and Table structs.
- Adds GetFullyQualifiedName() to NativeTables if --gen-name-strings is set.
- Adds a static Pack function to Tables that simply calls the global CreateX functions.

See cr/140391505 as an example of improved usage.

From cl/140529288.

Change-Id: Idec137c16129e15c1783f94fabdcea24aeeaaef6
* support for grpc golang

* refactored grpc go generator

* added grpc-go test and refactored

* refactored idl_gen_grpc.cpp

* fixed grpc generate method name

* refactored flatc and fixed line length issue

* added codec to go lib and fixed formatting issues

* fixed spacing issues
…-deserialitzation

Add a generic way to deserialize a flatbuffer in Go.
Avoid unsafe when sizing types
* Create basic issue template

* Update ISSUE_TEMPLATE.md
This was causing build failures with tools dependent on Flatbuffers in Go.
E.g.
go/src/github.com/google/flatbuffers/go/sizes.go:50: undefined: unsafe in unsafe.Pointer
Restore the ''import "unsafe'' removed in 36daedf
update json with documentation

removed comments
rouzier and others added 26 commits August 4, 2017 08:04
* Add support for boolean types in flexbuffers

* Simplify casting number <=> boolean

* Added comments for tests

* Add proper support for Booleans

* Bad rebase

* No special case for strings

* Removed unused test

* Simplify logic
Change-Id: Iff7895aebeba9c2940e26a3edbdf2d3f1b0d9b17
Change-Id: I5054e37833d59bbe925cac2000a453fbee8ef54b
Change-Id: I43e8de5a2ac224836a79661cc03bf37ac6d509fe
Change-Id: Ib94ef29254c116b60e4ff298baa2ce323ac9655c
Tested: on Linux.
Change-Id: Id7be5baba7d8a11ca050e8d94d95857406690378
Change-Id: Ia6d6967546c0a2a5340a93e54c46d2630fff92fe
Change-Id: Ie5a3bb5a3643cd48e1cc75fe170a7b8a7c2cc8ed
Tested: on Linux.
Change-Id: I58463b321703b2ef0dc3f3062633909b86eca1a9
Tested: on Linux.
* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes

* Generating the most strict TS code possible

* Not returning null when creating vectors

* Not returning null from struct contructors

* Copying required field to union type vector

* Removed unneccessary bool
* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes

* Generating the most strict TS code possible

* Not returning null when creating vectors

* Not returning null from struct contructors

* Vector of unions for ts/js

* Sanity check for languages

* Indentation fix + output test files

* Vectors of unions for php

* Fixes to union vector handling + tests
Change-Id: I7201d6891f56094178656a76bf0f87cf36d12554
* Add information about flexbuffer bool and null encoding

* Fix spelling errors

* Fix encoding example for flexbuffer map
* Add new type vector_bool

* Update stl_emulation.h

Fix Is same typo

* Update stl_emulation.h
Change-Id: I9378e375901f8a883eaeb2182955d690c358ed4b
Tested: on Linux.
Change-Id: I4bec0e728cc162aa3f19091a0d154124ffbccdff
Change-Id: I470143411e4ce6322e018a27bcc9cd40c15d9bf1
Tested: on Linux.
Change-Id: I5ed1f77868e201d7231102a106e08f3376b6adcf
Change-Id: Ie2965f48810bf24cccf098b69a9d471583efc3bf
Change-Id: I51db0511c52c79f2b322a1fdef798b061941887b
Change-Id: Idb607360123d12c73dd1e045305007120b12131b
Tested: on Linux.
Change-Id: Ic302096c07551b5c1aff0b261a329c46964cf337
Change-Id: I12fbba7ffd2db47502a05eb06cedab49fd99c366
@josephDunne
Copy link
Owner

Hi and thanks for the help! I will definitely go through the project tonight and create issues that need to be resolved before we can merge into the google code base

@josephDunne josephDunne merged commit 0ec9ff2 into josephDunne:rust_support Aug 21, 2017
@josephDunne
Copy link
Owner

Here is a starter:

  • Rust 1.15 introduces custom derive into stable rust - we should use that to derive flatbuffers builders from structs and enums. This is better than the macro system i was using. It will also reduce the amount of c++ code generation we need to maintain.
  • Update flatc code generation
  • Write more tests. Original feedback was that we need a fuzz test or at least test parity with the go implementation
  • I would like to redo the code in the iter.rs module
  • Implement more of the standard rust traits like ToOwned Hash etc where appropriate

optional stuff:

  • Flexbuffers
  • gRPC (perhaps best done in a separate crate)
  • I see some code in the merge discussing stores not sure if this is a Go specific thing

I will take some more time and create tickets. @hollinwilkins can you add to the above?

@hollinwilkins
Copy link
Author

@josephDunne Not sure if I have anything to add yet, I need to work on a few of these issues first then I will be more helpful. Let me know when you get the issues setup and we can start working through them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.