From f3bd9913ea478cf26fc43025043541bf395a200f Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Fri, 12 Apr 2019 17:34:13 -0300 Subject: [PATCH] I guess that is it! --- porque-rust.html | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/porque-rust.html b/porque-rust.html index eb5acbe..588aa48 100644 --- a/porque-rust.html +++ b/porque-rust.html @@ -679,6 +679,8 @@ OK(())

Macros

+ + ?
@@ -686,6 +688,50 @@ OK(())

Traits/Generics

+ +
+

+enum Result<T, E> {
+    Ok(T),
+    Err(E),
+}
+                        
+
+ +
+

+trait Summary {
+    fn summarize(&self) -> String;
+}
+						
+
+ +
+

+struct Super {
+    phrase: String
+}
+
+impl Summary for Super {
+    fn summarize(&self) -> String {
+        self.phrase
+            .split_whitespace()
+            .map(|word| word.chars().nth(0).unwrap())
+            .collect();
+    }
+}
+                        
+
+ +
+

+fn get_summary(summarizable: T) -> String
+    where T: Summary
+{
+    ...
+}
+                        
+