mm0.ps
mm.ps
bck-lifetimes.ps
+macros.ps
*.1
*.txt.eps
slides.pdf
SLIDES+= mm
SLIDES+= bck-lifetimes
+SLIDES+= macros
SLIDEFILES=$(addsuffix .ps, $(SLIDES))
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
--- /dev/null
+macro_rules! debug {
+ ($g:expr, $($rhs:tt)*) => { (if debugp!($g) { eprint!($($rhs)*); }) }
+}
--- /dev/null
+#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
--- /dev/null
+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();
+...
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 ]