workspace: move crates under crates
This commit is contained in:
parent
0016bc8cf0
commit
6393fdf3c0
354 changed files with 102 additions and 102 deletions
9
crates/utils/src/option_ext.rs
Normal file
9
crates/utils/src/option_ext.rs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
pub trait OptionExt<T> {
|
||||
fn get_or_insert_default_ext(&mut self) -> &mut T;
|
||||
}
|
||||
|
||||
impl<T: Default> OptionExt<T> for Option<T> {
|
||||
fn get_or_insert_default_ext(&mut self) -> &mut T {
|
||||
self.get_or_insert_with(|| Default::default())
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue