mailbox/header/reply_to.rs
1// DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2// Version 2, December 2004
3//
4// Copyleft (ↄ) meh. <meh@schizofreni.co> | http://meh.schizofreni.co
5//
6// Everyone is permitted to copy and distribute verbatim or modified
7// copies of this license document, and changing it is allowed as long
8// as the name is changed.
9//
10// DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11// TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12//
13// 0. You just DO WHAT THE FUCK YOU WANT TO.
14
15use std::io;
16use std::ops::Deref;
17use stream::entry::header;
18use util::Address;
19use super::Header;
20
21pub struct ReplyTo(Address);
22
23impl Header for ReplyTo {
24 #[inline(always)]
25 fn name() -> &'static str {
26 "Reply-To"
27 }
28
29 #[inline]
30 fn parse(values: &[header::Item]) -> io::Result<Self> {
31 Ok(ReplyTo(try!(Address::new(values[0].clone()))))
32 }
33}
34
35impl Deref for ReplyTo {
36 type Target = Address;
37
38 fn deref(&self) -> &Self::Target {
39 &self.0
40 }
41}