about summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-06-22 17:13:51 -0700
committerbors <bors@rust-lang.org>2013-06-22 17:13:51 -0700
commitfc83d82fec5bc338ffa4aaf00ca2aef6bfd473a4 (patch)
treeefbdac2a1b9c2f2f29551d33f8cc5dc61f4e565b /doc
parent0739c6b5a00372e6c7ed2f9bdafea8a8c0e383a6 (diff)
parent30d755957a0f2cc3be3b355671da79cdf34fd50a (diff)
downloadrust-fc83d82fec5bc338ffa4aaf00ca2aef6bfd473a4.tar.gz
rust-fc83d82fec5bc338ffa4aaf00ca2aef6bfd473a4.zip
auto merge of #7204 : alexcrichton/rust/deriving-to-string, r=pcwalton
Closes #7180 and #7179.

Before, the `deriving(ToStr)` attribute was essentially `fmt!("%?")`. This changes it to recursively invoke `to_str()` on fields instead of relying on `fmt!`-style things. This seems more natural to me and what should actually be expected.
Diffstat (limited to 'doc')
-rw-r--r--doc/rust.md4
1 files changed, 3 insertions, 1 deletions
diff --git a/doc/rust.md b/doc/rust.md
index f533bb50f75..3dc70ed10c7 100644
--- a/doc/rust.md
+++ b/doc/rust.md
@@ -1563,7 +1563,9 @@ Supported traits for `deriving` are:
 * `Rand`, to create a random instance of a data type.
 * `Zero`, to create an zero (or empty) instance of a data type.
 * `ToStr`, to convert to a string. For a type with this instance,
-  `obj.to_str()` has the same output as `fmt!("%?", obj)`.
+  `obj.to_str()` has similar output as `fmt!("%?", obj)`, but it differs in that
+  each constituent field of the type must also implement `ToStr` and will have
+  `field.to_str()` invoked to build up the result.
 
 # Statements and expressions