to_default 0.1.2

This library provides a convenient way to replace a typical usuage of `mem::replace`
Documentation
1
2
3
4
5
6
7
8
9
use ::std::default::Default;

pub trait ToDefault: Default + Sized {
	fn to_default(&mut self) -> Self {
		::std::mem::replace(self, Default::default())
	}
}

impl<T: Default> ToDefault for T {}