Skip to content
New issue

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

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

Already on GitHub? # to your account

Add helper functions to send the serialized data directly to a stream #5

Open
2 tasks
porky11 opened this issue Jul 19, 2021 · 4 comments
Open
2 tasks

Comments

@porky11
Copy link

porky11 commented Jul 19, 2021

This feature exists in the bincode crate, which simplifies reading from and writing to streams (like TCP) more comfortable.

  • Write data to stream (similar to this)
  • Read data from strem (similar to this)
@andylokandy
Copy link
Owner

andylokandy commented Jul 20, 2021

Wow! That's nice to have. I think it's better to update the TryWrite and TryRead.

@porky11
Copy link
Author

porky11 commented Jul 20, 2021

So instead of reading and writing to a byte slice you would read and write to/from a stream in the trait implementations already?

And when you really need it as a byte array locally, you can still create some internal/fake stream.
Not sure, if there's already a standard way of doing this, but I'd assume, there is.
In most cases, I either want to (de)serialize it to/from a network or file stream. When sending it to GPU, it might be necessary to have byte arrays, though.

This should also solve my other issue #6

@porky11
Copy link
Author

porky11 commented Jul 20, 2021

But this seems to not to work with this crate, since it cannot be done without std.

Maybe I should look for another crate or write one myself. A crate, which is only there for writing and reading any data to/from streams.

@porky11
Copy link
Author

porky11 commented Jul 21, 2021

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

No branches or pull requests

2 participants