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

New feature #1

Closed
Nyarum opened this issue Jun 15, 2014 · 5 comments
Closed

New feature #1

Nyarum opened this issue Jun 15, 2014 · 5 comments

Comments

@Nyarum
Copy link

Nyarum commented Jun 15, 2014

Hello, i very grateful for your work.
I have a proposal to introduce - Skip, Endian in structure.

@alecthomas
Copy link
Owner

Could you elaborate?

  • By skip, do you mean an annotation allowing a field to be skipped?
  • The endianness can be changed by setting binary.DefaultEndian, though I realise this isn't ideal.

@Nyarum
Copy link
Author

Nyarum commented Jun 16, 2014

  • Skip (Example)

type S1 struct {
Id int8 skip:"2"
Name string
}

byte[0x04, 0x05, 0x06, 0x5, 0x42, 0x6f, 0x62, 0x62, 0x79]

Result:

S1.Id = 6
S1.Name = Bobby

  • Endian (Example)

type S1 struct {
Id int8 Endian:"Big"
Name string Endian:"Little"
}

There are cases when Endian mixed.

@alecthomas
Copy link
Owner

Ok, I understand now. What's the use case for these? In general the package isn't designed for reading existing wire formats (eg. it only supports one method of encoding strings - varint length-prefixed), but I'm not sure what else these changes would be useful for?

@Nyarum
Copy link
Author

Nyarum commented Jun 16, 2014

  • Emulation protocols MMORPG games.
  • Parsing is not known formats.

Your package is currently closest to the realization of the desired functionality. As soon as I can get to the code, then I will send pull requests.

@alecthomas
Copy link
Owner

I think this is a good idea, but perhaps not for this package.

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

2 participants