1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
use super::*; impl<T: InspectRenderDefault<T>> InspectRenderDefault<Option<T>> for Option<T> { fn render( data: &[&Option<T>], label: &'static str, ui: &imgui::Ui, args: &InspectArgsDefault, ) { if data.is_empty() { ui.text(&imgui::im_str!("{}: None", label)); return; } let d = data[0]; match d { Some(value) => <T as InspectRenderDefault<T>>::render(&[value], label, ui, args), None => ui.text(&imgui::im_str!("{}: None", label)), }; } fn render_mut( data: &mut [&mut Option<T>], label: &'static str, ui: &imgui::Ui, args: &InspectArgsDefault, ) -> bool { if data.is_empty() { ui.text(&imgui::im_str!("{}: None", label)); return false; } let d = &mut data[0]; match d { Some(value) => { <T as InspectRenderDefault<T>>::render_mut(&mut [value], label, ui, args) } None => { ui.text(&imgui::im_str!("{}: None", label)); false } } } }