Skip to main content

with_preview

Function with_preview 

Source
pub fn with_preview<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> R
Expand description

Draws add in a child Ui in the preview families (set_preview): its text styles draw the interface preview (the monospace style, the monospace one), and inside it shown_font_id and the text roles of crate::ui give the preview families too. What draws with an explicit FontId keeps the theme’s fonts. Scopes nest; the previous state comes back when add returns, even when it panics.