WalletConnect / a2

An Asynchronous Apple Push Notification (apns2) Client for Rust
MIT License
136 stars 47 forks source link

feat: Switch `&str` params #67

Open HarryET opened 1 year ago

HarryET commented 1 year ago

Stop using &str with lifetime for the params and instead use impl Into<String>

MohammadAbuzar945 commented 1 year ago

Using impl Into<String> allows you to accept any type that can be converted into a String. This can be more flexible than using &str with a lifetime, because it allows the caller to pass in a variety of types, including owned Strings, &String, &str, and even types like String, Vec, and Box that implement the Intotrait.

HarryET commented 1 year ago

Yes, that is why we have this issue open to make that change, is it something you want to do @MohammadAbuzar945?

rex-remind101 commented 1 year ago

@HarryET This would imply removing the borrow parameter 'a and moving to using String in Payload correct? https://github.com/WalletConnect/a2/blob/0b29470b6d559a9b3ae8d7136151b0a8e32f60b3/src/request/payload.rs#L10

HarryET commented 1 year ago

@HarryET This would imply removing the borrow parameter 'a and moving to using String in Payload correct?

https://github.com/WalletConnect/a2/blob/0b29470b6d559a9b3ae8d7136151b0a8e32f60b3/src/request/payload.rs#L10

Correct, it should use String internally and all params should be S: Into<String> as a generic