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

Refactor generics #3

Closed
cmccomb opened this issue Nov 4, 2021 · 3 comments
Closed

Refactor generics #3

cmccomb opened this issue Nov 4, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@cmccomb
Copy link
Owner

cmccomb commented Nov 4, 2021

Standardize the interface to minimize generic use. Currently captures and repetitions use a generic (T: Into<String> + fmt::Display) which allows str, String, and HumanRegex as inputs. However, standardizing towards HumanRegex inputs only would enable more consistent usage - all raw text inputs would have to pass through the text or direct_regex functions, which would ensure more consistent escaping of special characters.

@cmccomb cmccomb added the invalid This doesn't seem right label Nov 4, 2021
@cmccomb cmccomb self-assigned this Nov 4, 2021
@cmccomb cmccomb added bug Something isn't working and removed invalid This doesn't seem right labels Nov 4, 2021
@m-kuzmin
Copy link

m-kuzmin commented May 7, 2022

Wouldnt it be better to return unit types that implement Into<HumanRegexEnum>, where HumanRegexEnum has all the unit types like this:

pub struct Ascii;
pub struct Hex;
// ...

pub enum HumanRegexEnum {
    Ascii,
    Hex,
    // ...
}

This also allows to implement #7.

@cmccomb
Copy link
Owner Author

cmccomb commented May 24, 2022

Great suggestion, I'll look into this too. Thanks for your interest!

@m-kuzmin
Copy link

Just remebered that you can use types from regex-syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants