3 ms·
Why is decode_* not a nice design?
by zaphar 3y ago
Why is decode_* not a nice design?
- dathinab 3y agoBecause you are now encoding parameter choices in function names instead of making them parameters. I mean it's not terrible design. But having to do a `use base64::prelude::{Engine, BASE64_STANDARD}` is also not terrible design. Nor is `use base64::engine::{Engine, general_purpose::STANDARD as BASE64}`, through it's less nice. So given that there is already and equally good design there anyway, there is no reason to add additional code, especially if that code would make it easier to make a mistake when using it. I guess if this would be designed now from scratch it would have something like a `decode(data, standard)` function, but `decode` is already in used (even through deprecated) so we can't have that.