Skip to content

Conversation

@danieleades
Copy link

fixes #7
I've made most of the functions generic over the input they actually need, rather than concrete types. I think there's still some work to be done to improve the api.

this is a minor breaking change as seen below-

before

fn example(s: String) {
   let x: String = s;
}

fn main() {
   let my_str : &'static str = "example string";

  // this won't compile after the change as type ascriptions would be required to determine how to apply 'into()'
   example(my_str.into())
}

after

fn example<S: Into<String>>(s: S) {
   let x: String = s.into();
}

fn main() {
   let my_str : &'static str = "example string";

  // consumer of library can now use any type which can be converted into a concrete string to call the function
   example(my_str)
}

@OtaK OtaK self-requested a review January 3, 2019 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants