chiark / gitweb /
wip
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 16 May 2019 00:06:24 +0000 (01:06 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 16 May 2019 00:06:24 +0000 (01:06 +0100)
.gitignore
Makefile
macro-rules-example.txt [new file with mode: 0644]
macros.fig [new file with mode: 0644]
serde-example.txt [new file with mode: 0644]
talk.txt

index 3097f76c1d9d3b81247050e802dd1f8401f9a804..61f2093a48ee17154f40d3ae260f62919b0a23d3 100644 (file)
@@ -2,6 +2,7 @@ intro.ps
 mm0.ps
 mm.ps
 bck-lifetimes.ps
+macros.ps
 *.1
 *.txt.eps
 slides.pdf
index 99703831a37c8a50c872371b86e5ec5dae274db1..07b1dcf935b29ca21a3ac8ff2408c3bf6b6f24a6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,7 @@ SLIDES+= mm0
 SLIDES+= mm
 
 SLIDES+= bck-lifetimes
+SLIDES+= macros
 
 SLIDEFILES=$(addsuffix .ps, $(SLIDES))
 
@@ -21,6 +22,7 @@ mm0.ps: mm.fig
        LC_CTYPE=en_GB fig2dev -L ps -l dummy -z A4 -D-60 <$@.1 $o
 
 bck-lifetimes.ps: bck-err.txt.eps
+macros.ps: serde-example.txt.eps macro-rules-example.txt.eps
 
 %.eps:   %.fig
        iconv <$< >$@.1 -f UTF-8 -t ISO-8859-1
diff --git a/macro-rules-example.txt b/macro-rules-example.txt
new file mode 100644 (file)
index 0000000..af3dc55
--- /dev/null
@@ -0,0 +1,3 @@
+macro_rules! debug {
+    ($g:expr, $($rhs:tt)*) => { (if debugp!($g) {   eprint!($($rhs)*); }) }
+}
diff --git a/macros.fig b/macros.fig
new file mode 100644 (file)
index 0000000..65d3daf
--- /dev/null
@@ -0,0 +1,24 @@
+#FIG 3.2  Produced by xfig version 3.2.6a
+Landscape
+Center
+Metric
+A4
+100.00
+Single
+-2
+1200 2
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        -1350 1125 10800 1125
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        -1350 5940 10800 5940
+2 5 0 1 0 -1 60 -1 -1 0.000 0 0 -1 0 0 5
+       0 serde-example.txt.eps
+        -1170 -2250 10800 -2250 10800 2430 -1170 2430 -1170 -2250
+4 0 0 50 -1 2 30 0.0000 4 375 2565 -900 2025 Ian Jackson\001
+4 0 0 50 -1 2 30 0.0000 4 330 1275 4050 2025 Citrix\001
+4 0 0 50 -1 2 30 0.0000 4 435 2115 5850 2025 May 2019\001
+4 0 0 50 -1 2 30 0.0000 4 435 5655 0 3870 curmudgeon and pessimist\001
+4 0 0 50 -1 2 30 0.0000 4 435 5400 0 4590 Perl, C, Tcl, Python, bash\001
+4 0 0 50 -1 2 30 0.0000 4 330 2505 -450 3240 Who am I ?\001
+4 0 0 50 -1 2 30 0.0000 4 435 10320 0 5310 some C++, Haskell, Ocaml, asm, JS, Lisp, Java...\001
+4 0 0 60 -1 0 20 0.0000 4 300 8715 -990 6570 Some examples taken from the Rust Book etc, Apache 2.0 / MIT\001
diff --git a/serde-example.txt b/serde-example.txt
new file mode 100644 (file)
index 0000000..c5c2f13
--- /dev/null
@@ -0,0 +1,14 @@
+use serde::{Serialize, Deserialize};
+
+#[derive(Serialize, Deserialize, Debug)]
+struct Point {
+    x: i32,
+    y: i32,
+}
+
+fn main() {
+    let point = Point { x: 1, y: 2 };
+
+    // Convert the Point to a JSON string.
+    let serialized = serde_json::to_string(&point).unwrap();
+...
index 5440e07ec982a60b6bc876ad7e43041c89086547..2e5772d43e37b2601de2f8a128e3518145abaecc 100644 (file)
--- a/talk.txt
+++ b/talk.txt
@@ -227,10 +227,12 @@ hide the issue from the API's consumer.  The awkwardness is tolerable.
 
 Rust does have macros.  In fact it has two ways to define macros (one
 built on top of the other).  The more sophisticated macro system is
-very capable and has been used to really impressive effect.  But it's
-hard to use casually; and the simpler macro definition facility is
-simultaneously too complicated and underpowered.  So casual macro use
-is slightly awkward.
+very capable and has been used to really impressive effect.  You can
+see an example here.
+
+But it's hard to use casually; and the simpler macro definition
+facility is simultaneously too complicated and underpowered.  So
+casual macro use is slightly awkward.
 
 [ cargo - dw posts, links ]