a2 icon indicating copy to clipboard operation
a2 copied to clipboard

feat: Switch `&str` params

Open HarryET opened this issue 3 years ago • 6 comments

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

HarryET avatar Dec 22 '22 16:12 HarryET

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 Into trait.

MohammadAbuzar945 avatar Jan 04 '23 02:01 MohammadAbuzar945

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

HarryET avatar Jan 04 '23 11:01 HarryET

@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

rex-remind101 avatar Jun 27 '23 17:06 rex-remind101

@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

HarryET avatar Jul 01 '23 11:07 HarryET