Created
July 8, 2014 16:44
-
-
Save apoelstra/d1e7ca6eaf70ce5f4ce6 to your computer and use it in GitHub Desktop.
borrow of RefCell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl <T:Serializable> Serializable for RefCell<T> { | |
fn serialize(&self) -> Vec<u8> { | |
self.borrow().serialize() | |
} | |
fn serialize_iter<'a>(&'a self) -> SerializeIter<'a> { | |
self.borrow().serialize_iter() | |
} | |
fn deserialize<I: Iterator<u8>>(iter: I) -> IoResult<RefCell<T>> { | |
let ret: T = try!(Serializable::deserialize(iter)); | |
Ok(RefCell::new(ret)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment