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

Any way to use generic string arguments? #5

Open
alexzaru opened this issue Jan 26, 2024 · 1 comment
Open

Any way to use generic string arguments? #5

alexzaru opened this issue Jan 26, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request question Further information is requested

Comments

@alexzaru
Copy link

There are several functions within the codebase that accept multiple <S: Into<String>> arguments. Consider the set_credentials function as an example:

pub fn set_credentials<S: Into<String>>(&mut self, username: S, password: S) -> &mut Self {
    self.credentials = Some((username.into(), password.into()));
    self....
    ...
}

The current implementation enforces that each argument must be of the exact same type. This behavior may not align with the intended functionality. The preference would be to allow different types for the two arguments, as long as they both implement the Into<String> trait.

@sigrlami
Copy link
Owner

This is intentional, as I wanted to maintain type safety and reduce unexpected behavior. I'll add this on a list maybe we can make it configurable via some parameter, but I would prefer to stick with concrete types.

@sigrlami sigrlami self-assigned this Jan 26, 2024
@sigrlami sigrlami added enhancement New feature or request question Further information is requested labels Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants