sigrlami / glaze-mq

Multi-protocol exchange broker for IoT within the 5G-and-Beyond networks, and primary emphasis on scalability.
MIT License
12 stars 2 forks source link

Any way to use generic string arguments? #5

Open alexzaru opened 9 months ago

alexzaru commented 9 months ago

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 commented 9 months ago

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.