Uh oh!
There was an error while loading. Please reload this page.
Add a doctest for the std::string::as_string method. - #19628
Conversation
jbranchaud
commented
Dec 8, 2014
Sure thing! |
jbranchaud
commented
Dec 8, 2014
@steveklabnik Is "Examples" supposed to be the standard convention? I am noticing the occurrence of "Example" a number of places throughout the API docs. If so, I can try to update some of these other offending instances in a separate PR as well. |
steveklabnik
commented
Dec 8, 2014
We haven't officially made a convention because I haven't had the chance to write up the RFC, but you're correct that they're scattered. I wouldn't mind a PR updating them to all say "Examples," even if we eventually decide on a different convention, it's easier to change if they're all the same. |
60f916e to
0beb7d8Comparejbranchaud
commented
Dec 8, 2014
Updated. |
bluss
commented
Dec 8, 2014
Intrusive comment! :-) I'm worried about "Doctest". Providing examples in documentation is great, it's a good goal. Testing functions through it is not -- there are much better ways to do that using the testing infrastructure. So they should be useful examples first. The reason they are tested is just to make sure they continue to be up to date and correct. With this in mind, the example in the PR is not very instructive to the reader of the documentation. |
bluss
commented
Dec 8, 2014
I should be constructive too, It's hard to find a good example truly, what do you think about this? use std::string::as_string;fnstringconsumer(s:&String){assert_eq!(s,&"foo");}stringconsumer(&*as_string("foo")); |
0beb7d8 to
6dc9828Comparejbranchaud
commented
Dec 9, 2014
There was a problem hiding this comment.
Taking a &String is almost never what we want, can we make this a String and
steveklabnik
commented
Dec 9, 2014
r=me with the updated example changes |
Change Example to Examples. Add a doctest that better demonstrates the utility of as_string. Update the doctest example to use String instead of &String.
6dc9828 to
de3fceeComparejbranchaud
commented
Dec 10, 2014
Updated. |
steveklabnik
commented
Dec 10, 2014
Thank you so much! |
bluss
commented
Dec 10, 2014
Friends, the example misses the point of The reason any example is contrieved is that there are no use cases I can think of, but what it used to be was that a certain interface needed |
don't ignore config values that fail to parse
No description provided.