+// ## Traits and borrowed types
+
+// Writing this out becomes a bit tedious, because trait implementations (unlike functions) require full explicit annotation
+// of lifetimes. Make sure you understand exactly what the following definition says.
+impl<'a, 'b> ops::Add<&'a BigInt> for &'b BigInt {
+ type Output = BigInt;
+ fn add(self, rhs: &'a BigInt) -> Self::Output {
+ // **Exercise 08.3**: Implement this function.
+ unimplemented!()
+ }
+}
+
+// ## Modules
+
+// Rust calls a bunch of definitions that are grouped together a *module*. You can put definitions in a submodule as follows.
+mod my_mod {
+ type MyType = i32;
+ fn my_fun() -> MyType { 42 }
+}
+
+// For the purpose of testing, one typically introduces a module called `tests` and tells the compiler
+// (by means of the `cfg` attribute) to only compile this module for tests.
+#[cfg(test)]
+mod tests {
+ #[test]
+ fn test_add() {
+ let b1 = BigInt::new(1 << 32);
+ let b2 = BigInt::from_vec(vec![0, 1]);
+
+ assert_eq!(&b1 + &b2, BigInt::from_vec(vec![1 << 32, 1]));
+ // **Exercise 08.4**: Add some more testcases.
+ }
+}
+