3 ms·
// 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::stri
by blackrock 8y ago
// 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())
}