You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>The <code>ExchangeData</code> trait is more complicated, and is established in the <code>communication/</code> module. There are two options for this trait, which are determined by whether you use the <code>--bincode</code> feature at compilation, or not.</p>
186
-
<ul>
187
-
<li>
188
-
<p>If you use <code>--bincode</code> then the trait is a synonym for</p>
185
+
<p>The <code>ExchangeData</code> trait is more complicated, and is established in the <code>communication/</code> module. The trait is a synonym for</p>
<p>where <code>serde</code> is Rust's most popular serialization and deserialization crate. A great many types implement these traits. If your types does not, you should add these decorators to their definition:</p>
<p>You must include the <code>serde</code> crate, and if not on Rust 2018 the <code>serde_derive</code> crate.</p>
193
-
<p>The downside to the <code>--bincode</code> flag is that deserialization will always involve a clone of the data, which has the potential to adversely impact performance. For example, if you have structures that contain lots of strings, timely dataflow will create allocations for each string even if you do not plan to use all of them.</p>
194
-
</li>
195
-
<li>
196
-
<p>If you do not use the <code>--bincode</code> feature, then the <code>Serialize</code> and <code>Deserialize</code> requirements are replaced by <code>Abomonation</code>, from the <code>abomonation</code> crate. This trait allows in-place deserialization, but is implemented for fewer types, and has the potential to be a bit scarier (due to in-place pointer correction).</p>
197
-
<p>Your types likely do not implement <code>Abomonation</code> by default, but you can similarly use</p>
<p>You must include the <code>abomonation</code> and <code>abomonation_derive</code> crate for this to work correctly.</p>
200
-
</li>
201
-
</ul>
190
+
<p>The downside to is that deserialization will always involve a clone of the data, which has the potential to adversely impact performance. For example, if you have structures that contain lots of strings, timely dataflow will create allocations for each string even if you do not plan to use all of them.</p>
<p>Let's imagine you would like to play around with a tree data structure as something you might send around in timely dataflow. I've written the following candidate example:</p>
@@ -278,7 +267,7 @@ <h3 id="exchanging-data"><a class="header" href="#exchanging-data">Exchanging da
278
267
}
279
268
}</code></pre>
280
269
<p>We get a new error. A not especially helpful error. It says that it cannot find an <code>exchange</code> method, or more specifically that one exists but it doesn't apply to our type at hand. This is because the data need to satisfy the <code>ExchangeData</code> trait but do not. It would be better if this were clearer in the error messages, I agree.</p>
281
-
<p>We can fix the problem two ways. First, if you would like to use <code>bincode</code>, then we update the source like so:</p>
@@ -288,8 +277,8 @@ <h3 id="exchanging-data"><a class="header" href="#exchanging-data">Exchanging da
288
277
data: D,
289
278
children: Vec<TreeNode<D>>,
290
279
}</code></pre>
291
-
<p>and make sure to include the <code>serde_derive</code> and <code>serde</code> crates. Now when we run things (notice the <code>--features</code> flag) we see:</p>
292
-
<pre><codeclass="language-ignore"> Echidnatron% cargo run --example types --features bincode
280
+
<p>and make sure to include the <code>serde_derive</code> and <code>serde</code> crates.</p>
281
+
<pre><codeclass="language-ignore"> Echidnatron% cargo run --example types
293
282
Finished dev [unoptimized + debuginfo] target(s) in 0.07s
<p>The <code>ExchangeData</code> trait is more complicated, and is established in the <code>communication/</code> module. There are two options for this trait, which are determined by whether you use the <code>--bincode</code> feature at compilation, or not.</p>
1852
-
<ul>
1853
-
<li>
1854
-
<p>If you use <code>--bincode</code> then the trait is a synonym for</p>
1851
+
<p>The <code>ExchangeData</code> trait is more complicated, and is established in the <code>communication/</code> module. The trait is a synonym for</p>
<p>where <code>serde</code> is Rust's most popular serialization and deserialization crate. A great many types implement these traits. If your types does not, you should add these decorators to their definition:</p>
<p>You must include the <code>serde</code> crate, and if not on Rust 2018 the <code>serde_derive</code> crate.</p>
1859
-
<p>The downside to the <code>--bincode</code> flag is that deserialization will always involve a clone of the data, which has the potential to adversely impact performance. For example, if you have structures that contain lots of strings, timely dataflow will create allocations for each string even if you do not plan to use all of them.</p>
1860
-
</li>
1861
-
<li>
1862
-
<p>If you do not use the <code>--bincode</code> feature, then the <code>Serialize</code> and <code>Deserialize</code> requirements are replaced by <code>Abomonation</code>, from the <code>abomonation</code> crate. This trait allows in-place deserialization, but is implemented for fewer types, and has the potential to be a bit scarier (due to in-place pointer correction).</p>
1863
-
<p>Your types likely do not implement <code>Abomonation</code> by default, but you can similarly use</p>
<p>You must include the <code>abomonation</code> and <code>abomonation_derive</code> crate for this to work correctly.</p>
1866
-
</li>
1867
-
</ul>
1856
+
<p>The downside to is that deserialization will always involve a clone of the data, which has the potential to adversely impact performance. For example, if you have structures that contain lots of strings, timely dataflow will create allocations for each string even if you do not plan to use all of them.</p>
<p>Let's imagine you would like to play around with a tree data structure as something you might send around in timely dataflow. I've written the following candidate example:</p>
@@ -1944,7 +1933,7 @@ <h3 id="exchanging-data"><a class="header" href="#exchanging-data">Exchanging da
1944
1933
}
1945
1934
}</code></pre>
1946
1935
<p>We get a new error. A not especially helpful error. It says that it cannot find an <code>exchange</code> method, or more specifically that one exists but it doesn't apply to our type at hand. This is because the data need to satisfy the <code>ExchangeData</code> trait but do not. It would be better if this were clearer in the error messages, I agree.</p>
1947
-
<p>We can fix the problem two ways. First, if you would like to use <code>bincode</code>, then we update the source like so:</p>
@@ -1954,8 +1943,8 @@ <h3 id="exchanging-data"><a class="header" href="#exchanging-data">Exchanging da
1954
1943
data: D,
1955
1944
children: Vec<TreeNode<D>>,
1956
1945
}</code></pre>
1957
-
<p>and make sure to include the <code>serde_derive</code> and <code>serde</code> crates. Now when we run things (notice the <code>--features</code> flag) we see:</p>
1958
-
<pre><codeclass="language-ignore"> Echidnatron% cargo run --example types --features bincode
1946
+
<p>and make sure to include the <code>serde_derive</code> and <code>serde</code> crates.</p>
1947
+
<pre><codeclass="language-ignore"> Echidnatron% cargo run --example types
1959
1948
Finished dev [unoptimized + debuginfo] target(s) in 0.07s
0 commit comments