mirror of
https://github.com/emilk/egui.git
synced 2026-06-27 23:13:13 -04:00
add Deref for Ui
This commit is contained in:
@@ -16,7 +16,7 @@ use epaint::{
|
||||
#[derive(Clone)]
|
||||
pub struct Painter {
|
||||
/// Source of fonts and destination of shapes
|
||||
ctx: Context,
|
||||
pub(crate) ctx: Context,
|
||||
|
||||
/// Where we paint
|
||||
layer_id: LayerId,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#![warn(missing_docs)] // Let's keep `Ui` well-documented.
|
||||
#![allow(clippy::use_self)]
|
||||
|
||||
use std::{any::Any, hash::Hash, sync::Arc};
|
||||
use std::{any::Any, hash::Hash, ops::Deref, sync::Arc};
|
||||
|
||||
use epaint::mutex::RwLock;
|
||||
|
||||
@@ -2320,6 +2320,14 @@ impl Ui {
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for Ui {
|
||||
type Target = Context;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
self.ctx()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
impl Drop for Ui {
|
||||
fn drop(&mut self) {
|
||||
|
||||
Reference in New Issue
Block a user