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

Cleanup filtration code #235

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

SkeletalDemise
Copy link
Collaborator

  • 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
Copy link
Collaborator

@swanandx swanandx left a 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`.
Copy link
Collaborator

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 {
Copy link
Collaborator

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

Comment on lines +85 to +88
impl CrackResults {
#[allow(dead_code)]
/// Returns the `CrackResult` if the checker succeeds.
pub fn break_value(self) -> Option<CrackResult> {
Copy link
Collaborator

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.

Comment on lines +108 to +125
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),
Copy link
Collaborator

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?

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

Successfully merging this pull request may close these issues.

2 participants