mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
add Deref for Ui
This commit is contained in:
@@ -16,7 +16,7 @@ use epaint::{
|
|||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Painter {
|
pub struct Painter {
|
||||||
/// Source of fonts and destination of shapes
|
/// Source of fonts and destination of shapes
|
||||||
ctx: Context,
|
pub(crate) ctx: Context,
|
||||||
|
|
||||||
/// Where we paint
|
/// Where we paint
|
||||||
layer_id: LayerId,
|
layer_id: LayerId,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#![warn(missing_docs)] // Let's keep `Ui` well-documented.
|
#![warn(missing_docs)] // Let's keep `Ui` well-documented.
|
||||||
#![allow(clippy::use_self)]
|
#![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;
|
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)]
|
#[cfg(debug_assertions)]
|
||||||
impl Drop for Ui {
|
impl Drop for Ui {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
|
|||||||
Reference in New Issue
Block a user