Conversation
|
Code is kind of rough, but I am kind of new to rust, so am fighting my understanding to get it polished. Help would be hugely appreciated. I have the |
|
Thanks; I should be able to take a close look at this in the next couple of days. Perhaps this can re-use I'm fine with just getting the Food for thought -- we should leave room nomenclature-wise, etc, for the decoding side ( |
|
re: just the write side -- works for me. I dropped the read side of my impl in this gist, complete with debug output and lots of room for improvement :-) |
|
I've started tinkering in https://github.com/alicemaz/rust-base64/tree/brianm-encoder. I'll add benchmarks and some more tests next. |
|
Argh, line endings continue to be a pain. Go's encoder doesn't attempt to handle the line wrapping requirements of things like MIME-flavored base64, so of course this implementation doesn't either. I really regret ever adding them to this library. It enormously complicates things. Noted in https://github.com/marshallpierce/rust-base64-experimental to not do that again... Anyway for this task I think it's probably acceptable to simply delegate to another |
|
We can inspect the config and insert the Write proxy... if I understand correctly. Btw, learned a ton looking at your cleanups, thank you :-) |
|
Happy to help. Feel free to interactively hassle me on irc, etc. :) If we insert another layer then we couldn't have devirtualized types since the return type of some hypothetical builder would be polymorphic. :'( I'm considering ripping line wrapping out of I'm currently kinda stuck thinking about how to handle encoding the leftover 0-2 bytes. On the other hand, if we have an extra If we do end up using |
|
Sorry for the delay, was traveling for a while. I'll be back on this in the next couple of days; I'd like to get this shipped in some form soon. |
|
No need to apologize to me, I have likewise been busy. I hugely appreciate you paying attention this! Thank you! |
|
re: finishing -- I have been of both thoughts. We don't have a I think I fall on the side of The alt, of course, is that we make it configurable, which seems like a weak punt. |
|
We're kinda damned if we do, damned if we don't.
It looks like flate2 went with option 3, in spirit at least: https://github.com/alexcrichton/flate2-rs/blob/master/src/gz/write.rs
|
|
I asked Alex about the approach he took in flate2; he said it was fine for synchronous i/o and a pain for async, but didn't have any magical solutions to make async smoother. So, since no further inspiration has struck, I'm favoring option 3. |
|
option 3 works, amounts to flush on drop for the naive case, which wil lprobbly cause things to normally work, and folks will look at docs in abnormal case. |
|
Sorry for the continued delay; I'm really busy but I haven't forgotten about this! The open tab haunts me... |
|
I made a bit more progress on this a while back, and also discovered that Java's Base64 class doesn't do line wrapping either, which lends further weight to the idea of ripping that out (at least as a core part of encoding). |
|
I realize I'm letting the perfect be the enemy of the good here; hopefully the lack of this isn't ruining anyone's day/week/month. |
|
It is okay, I am not blocked, my... much worse implementation solved my immediate problem. Is their aught I can do to help? |
|
Find me an extra 4h/day? :) |
|
What's the status on this? |
|
Embarrassingly delayed? :( The project that's been keeping me busy all summer asks every hour of me that I can give, but it will be done in the next few weeks, and then I can finally knock this off my to do list. Basically what this needs is more tests, possibly #60 or something like it, and some naming reorganization to make room (ala flate2, for instance) for all 4 |
|
I kinda need this for Servo, do you want me to carry that patch to completion? |
|
Having someone actually need this is a good motivator! Can it wait until the weekend? If so, I will do my utmost to get to it then, and if not, you have my blessing to charge ahead. (I've been thinking about this feature off and on for quite a while, and I have some ideas I'd like to flesh out.) |
|
It can wait for this weekend for sure. I can also review your code if you would like. |
|
That'd be excellent, looking forward to it. |
|
BTW, do you have thoughts on #60? |
|
Well, it's a nice number, multiple of 2, 3 and 5. Joke aside, nope, we use base64 mostly for |
|
Finally making headway on this in #74. |
Implements
std::io::Writetransforming inputs to base64, for use in io chains. Part of #20Implementation is based on Golang's