Fix to the new nightly.
[crypto_lab1.git] / lab1_rust / src / packet.rs
index 7e9c38c..ec63d9e 100644 (file)
@@ -6,6 +6,7 @@ use serialize::hex::{ ToHex };
 use self::PacketType::{ Command, Answer, Error };
 use crypto;
 
+#[deriving(Show, Copy)]
 pub enum Variant {
    Weak, // The MAC is computed on data without padding.
    Fixed // The MAC is computed on data and padding.
@@ -28,7 +29,7 @@ pub enum ReadingError {
 // A macro to return a 'Err(ReadingError::IO(..))' in case of error.
 macro_rules! try_read_io(
    ($e:expr) => (match $e { Ok(e) => e, Err(e) => return Err(ReadingError::IO(e)) })
-)
+);
 
 // There are all the errors that may occur when encrypting, authenticating and writing a packet.
 #[deriving(Show)]
@@ -40,7 +41,7 @@ pub enum WritingError {
 // A macro to return a 'Err(WritingError::IO(..))' in case of error.
 macro_rules! try_write_io(
    ($e:expr) => (match $e { Ok(e) => e, Err(e) => return Err(WritingError::IO(e)) })
-)
+);
 
 pub type ReadingResult = Result<Packet, ReadingError>;
 pub type WritingResult = Result<(), WritingError>;
@@ -102,7 +103,7 @@ impl fmt::Show for PacketType {
       match self {
          &Command(ref data) => write!(formatter, "Command {{ {} }}", data_to_str(data)),
          &Answer(ref data) => write!(formatter, "Answer {{ {} }}", data_to_str(data)),
-         &Error(error_type) => write!(formatter, "Error {{ errorType: {} }}", error_type)
+         &Error(ref error_type) => write!(formatter, "Error {{ errorType: {} }}", error_type)
       }
    }
 }