News for hackers. Stuff that matters.
Re:Rust is Not so Hairy by blackrock on Tuesday June 19, 2018 @04:15PM (#17349953)
// Mutable pointer to the field.

// If field is not initialized, it is initialized with default value first.

pub fn mut_message(&mut self) -> &mut ::std::string::String {

        &mut self.message
}

=========

Geez, this is ugly.

And here's another..

=========

// Take field

pub fn take_message(&mut self) -> ::std::string::String {

        ::std::mem::replace(&mut self.message, ::std::string::String::new())

}

There are no comments on this comment yet.