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

the codes in the example are wrong #46

Open
xiaodaigh opened this issue Oct 5, 2019 · 1 comment
Open

the codes in the example are wrong #46

xiaodaigh opened this issue Oct 5, 2019 · 1 comment

Comments

@xiaodaigh
Copy link
Contributor

module Example

using FlatBuffers
@with_kw mutable struct SimpleType
    x::Int32 = 1
end

# ... other generated stuff
end

import FlatBuffers, Example

# create an instance of our type
val = Example.SimpleType(2)

# serialize it to example.bin
open("example.bin", "w") do f FlatBuffers.serialize(f, val) end

# read the value back again from file
val2 = open("example.bin", "r") do f Example.SimpleType(f) end

gives error

The correct code is

val2 = open("example.bin", "r") do f 
  FlatBuffers.deserialize(f, Example.SimpleType)
end
@xiaodaigh
Copy link
Contributor Author

Fix in #45

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

No branches or pull requests

1 participant