Commit Graph

136 Commits

Author SHA1 Message Date
Andre Bogus
95c96dd379 fix doc links 2017-02-17 05:03:05 +01:00
Andre Bogus
c0b541d6af added derive(new) link 2017-02-16 08:50:43 +01:00
Andre Bogus
65492bc7b2 more default vs. constructor distinction 2017-02-15 18:35:24 +01:00
Andre Bogus
ad1c9ee228 lowercase 'constructor' 2017-02-15 09:16:26 +01:00
Andre Bogus
8be913e83c use a configuration-themed example 2017-02-09 09:10:55 +01:00
Andre Bogus
48a41e8eda fix small code mistake 2017-01-03 06:52:35 +01:00
Andre Bogus
964dd9932b Added comment to explain second example 2017-01-01 05:26:33 +01:00
Andre Bogus
53b35444b6 new idiom: Default trait 2016-12-31 14:56:54 +01:00
Andre Bogus
d827cec092 Add another example to the mem::replace idiom
This fixes #38
2016-12-18 21:24:30 +01:00
diwic
5f484ad473 Change "".to_string() to String::new()
I mistakenly lost this change in my previous pull request, sorry!
2016-10-12 08:50:29 +02:00
Chris Wong
9d955043a4 Merge pull request #33 from partim/take-for-replace
Mention Option::take() as an alternative to mem::replace()
2016-10-10 21:58:42 +13:00
Martin Hoffmann
9fd6a8f9cf Fix language. 2016-10-10 10:52:57 +02:00
David Henningsson
3bec875bdc Merge remote-tracking branch 'dd/patch-1'
Conflicts:
	idioms/mem-replace.md
2016-10-10 08:10:49 +02:00
Chris Wong
26e27cd307 Merge pull request #32 from xfix/patch-1
Prepending _ to field name avoids unused field warning
2016-10-10 09:20:06 +13:00
diwic
490fb34bb2 Improve mem-replace example
Submitting a PR as suggested by llogiq [here](https://www.reddit.com/r/rust/comments/56l2pk/an_underused_idiom_memreplace_to_avoid_clones/d8kksx6)
2016-10-09 19:47:44 +02:00
CasualX
69de2351f2 Fix a few nits with the replace idiom.
Change the match guard to be part of the pattern.

Change `"".to_string()` to a more idiomatic `String::new()` to create a new `String` without memory allocation.
2016-10-09 15:35:57 +02:00
Martin Hoffmann
618a65c337 Mention Option::take() as an alternative to mem::replace() 2016-10-09 13:39:26 +02:00
Konrad Borowski
6af4003b88 Prepending _ to field name avoids unused field warning 2016-10-09 12:51:01 +02:00
Andre Bogus
547ff18605 Adressed comments 2016-10-08 19:14:05 +02:00
Andre Bogus
31b282ad9f new idiom: mem::replace 2016-10-08 08:51:31 +02:00
Nick Cameron
3d748b1adc Merge pull request #25 from lfairy/option-list
Add "Treating Option like a list"
2016-09-30 09:37:10 +13:00
Chris Wong
f3fe2d6f28 Iterating over an Option 2016-09-29 23:52:13 +13:00
Mikhail Trishchenkov
1bc8a36a2f Small title fix 2016-09-27 16:01:35 +13:00
Mikhail Trishchenkov
67685cddf0 Rename idiom 2016-09-27 16:01:35 +13:00
Mikhail Trishchenkov
9f85aad151 Fix review issues
Replace tabs with spaces, mention usage for borrowing, add disadvantage
(code indentation increase).
2016-09-27 16:01:35 +13:00
Mikhail Trishchenkov
72606ccfcb Clone to closure idiom 2016-09-27 16:01:35 +13:00
Nick Cameron
6ac851e718 Add the extensibility by privacy pattern
(And change the concatenation pattern to say something different about perf)
2015-12-09 10:59:30 +13:00
Nick Cameron
c2cf5e6c1a Deref polymorphism anti-pattern 2015-11-01 21:31:24 -05:00
Nick Cameron
a06ca32e70 Merge pull request #15 from liigo/patch-3
improve comment
2015-10-28 09:13:30 -04:00
liigo
d4fa321a38 improve comment 2015-10-28 09:09:57 +08:00
liigo
ea3aa4d310 fix compile error in comment 2015-10-28 09:04:38 +08:00
Steve Gury
5bc7f3a99c Fix a minor typo s/he/the/ 2015-10-23 09:54:08 -07:00
Nick Cameron
325b642a01 Added a few idioms and patterns - some are still WIP 2015-10-23 09:53:16 +13:00
Nick Cameron
cf8479320a Add missing file for concatenating strings 2015-10-20 09:45:11 +13:00
Nick Cameron
65f12dcaab link ctor -> builder 2015-10-15 15:12:37 +13:00
Nick Cameron
248baabc14 Add the constructor idiom. 2015-08-31 16:24:54 +12:00