-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Cleanup filtration code #235
base: main
Are you sure you want to change the base?
Conversation
SkeletalDemise
commented
May 17, 2023
- made a macro for decoders, reducing code length and complexity
- cleaned up the imports
- cleaned up code
* made a macro for decoders, reducing code length and complexity * cleaned up the imports * cleaned up code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added few suggestions!
pub enum MyResults { | ||
/// Variant containing successful [`CrackResult`] | ||
/// Enum representing the result of a cracking operation. | ||
/// If the checker succeeds, it returns the `Break` variant containing `CrackResult`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those "[]" are for docs to link to CrackResult. [`CrackResult`]
will point to docs of CrackResult
.
/// Enum representing the result of a cracking operation. | ||
/// If the checker succeeds, it returns the `Break` variant containing `CrackResult`. | ||
/// Otherwise, it returns the `Continue` variant with a vector of `CrackResult` for further processing. | ||
pub enum CrackResults { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was named that way to avoid confusion between CrackResult
and CrackResults
impl CrackResults { | ||
#[allow(dead_code)] | ||
/// Returns the `CrackResult` if the checker succeeds. | ||
pub fn break_value(self) -> Option<CrackResult> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move this impl block under mod test
, as break_value
is used only in tests.
create_decoder!(ReverseDecoder), | ||
create_decoder!(Base64Decoder), | ||
create_decoder!(Base58BitcoinDecoder), | ||
create_decoder!(Base58MoneroDecoder), | ||
create_decoder!(Base58RippleDecoder), | ||
create_decoder!(Base58FlickrDecoder), | ||
create_decoder!(Base91Decoder), | ||
create_decoder!(Base65536Decoder), | ||
create_decoder!(BinaryDecoder), | ||
create_decoder!(HexadecimalDecoder), | ||
create_decoder!(Base32Decoder), | ||
create_decoder!(MorseCodeDecoder), | ||
create_decoder!(AtbashDecoder), | ||
create_decoder!(CaesarDecoder), | ||
create_decoder!(RailfenceDecoder), | ||
create_decoder!(CitrixCTX1Decoder), | ||
create_decoder!(URLDecoder), | ||
create_decoder!(Base64URLDecoder), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be better if we can just pass in all of decoders in single macro? like
create_decoders!(ReverseDecoder, Base64Decoder, Base58.....)
which would return a array ( doesn't need to a Vec as deocders are fixed right?? ) of Decoders?