blob: 6bc49ee8a673d57c9a2fe6328389b5d4e57b0dfa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#[macro_use]
extern crate error_chain;
extern crate mysql;
mod errors {
error_chain! {}
}
use errors::*;
struct Purchaser<'a> {
name: &'a str,
email: &'a str,
secret: Option<&'a str>,
}
impl<'a> Purchaser<'a> {
fn new(name: &'a str, email: &'a str) -> Self {
Purchaser {
name: name,
email: email,
secret: None,
}
}
fn with_secret(mut self, secret: &'a str) -> Self {
self.secret = Some(secret);
self
}
fn insert() -> Result<()> {
unimplemented!()
}
}
|