Browse Source

Remove epaint::mutex::Arc type alias

pull/1503/head
Emil Ernerfeldt 3 years ago
parent
commit
2355828d41
  1. 1
      egui/src/context.rs
  2. 2
      egui/src/data/input.rs
  3. 2
      egui/src/grid.rs
  4. 2
      egui/src/memory.rs
  5. 3
      egui/src/menu.rs
  6. 3
      egui/src/painter.rs
  7. 4
      egui/src/style.rs
  8. 4
      egui/src/ui.rs
  9. 2
      egui/src/util/id_type_map.rs
  10. 2
      egui/src/widget_text.rs
  11. 2
      egui/src/widgets/text_edit/builder.rs
  12. 12
      epaint/src/mutex.rs
  13. 18
      epaint/src/shape.rs
  14. 3
      epaint/src/text/font.rs
  15. 3
      epaint/src/text/fonts.rs
  16. 3
      epaint/src/text/text_layout.rs
  17. 3
      epaint/src/text/text_layout_types.rs
  18. 8
      epaint/src/texture_handle.rs

1
egui/src/context.rs

@ -1,4 +1,5 @@
// #![warn(missing_docs)]
use std::sync::Arc;
use crate::{
animation_manager::AnimationManager, data::output::PlatformOutput, frame_state::FrameState,

2
egui/src/data/input.rs

@ -146,7 +146,7 @@ pub struct DroppedFile {
/// Set by the `egui_web` backend.
pub last_modified: Option<std::time::SystemTime>,
/// Set by the `egui_web` backend.
pub bytes: Option<epaint::mutex::Arc<[u8]>>,
pub bytes: Option<std::sync::Arc<[u8]>>,
}
/// An input event generated by the integration.

2
egui/src/grid.rs

@ -46,7 +46,7 @@ impl State {
pub(crate) struct GridLayout {
ctx: Context,
style: epaint::mutex::Arc<Style>,
style: std::sync::Arc<Style>,
id: Id,
/// State previous frame (if any).

2
egui/src/memory.rs

@ -99,7 +99,7 @@ pub struct Memory {
pub struct Options {
/// The default style for new [`Ui`](crate::Ui):s.
#[cfg_attr(feature = "serde", serde(skip))]
pub(crate) style: epaint::mutex::Arc<Style>,
pub(crate) style: std::sync::Arc<Style>,
/// Controls the tessellator.
pub tessellation_options: epaint::TessellationOptions,

3
egui/src/menu.rs

@ -20,7 +20,8 @@ use super::{
Sense, TextStyle, Ui, Vec2,
};
use crate::{widgets::*, *};
use epaint::{mutex::Arc, mutex::RwLock, Stroke};
use epaint::{mutex::RwLock, Stroke};
use std::sync::Arc;
/// What is saved between frames.
#[derive(Clone, Default)]

3
egui/src/painter.rs

@ -1,4 +1,5 @@
use std::ops::RangeInclusive;
use std::sync::Arc;
use crate::{
emath::{pos2, Align2, Pos2, Rect, Vec2},
@ -6,7 +7,7 @@ use crate::{
Color32, Context, FontId,
};
use epaint::{
mutex::{Arc, RwLockReadGuard, RwLockWriteGuard},
mutex::{RwLockReadGuard, RwLockWriteGuard},
text::{Fonts, Galley},
CircleShape, RectShape, Rounding, Shape, Stroke,
};

4
egui/src/style.rs

@ -3,7 +3,7 @@
#![allow(clippy::if_same_then_else)]
use crate::{color::*, emath::*, FontFamily, FontId, Response, RichText, WidgetText};
use epaint::{mutex::Arc, Rounding, Shadow, Stroke};
use epaint::{Rounding, Shadow, Stroke};
use std::collections::BTreeMap;
// ----------------------------------------------------------------------------
@ -35,7 +35,7 @@ pub enum TextStyle {
/// ```
/// egui::TextStyle::Name("footing".into());
/// ````
Name(Arc<str>),
Name(std::sync::Arc<str>),
}
impl std::fmt::Display for TextStyle {

4
egui/src/ui.rs

@ -1,7 +1,9 @@
// #![warn(missing_docs)]
use epaint::mutex::{Arc, RwLock, RwLockReadGuard, RwLockWriteGuard};
use std::hash::Hash;
use std::sync::Arc;
use epaint::mutex::{RwLock, RwLockReadGuard, RwLockWriteGuard};
use crate::{
color::*, containers::*, epaint::text::Fonts, layout::*, menu::MenuState, placer::Placer,

2
egui/src/util/id_type_map.rs

@ -3,8 +3,8 @@
// For non-serializable types, these simply return `None`.
// This will also allow users to pick their own serialization format per type.
use epaint::mutex::Arc;
use std::any::Any;
use std::sync::Arc;
// -----------------------------------------------------------------------------------------------

2
egui/src/widget_text.rs

@ -1,4 +1,4 @@
use epaint::mutex::Arc;
use std::sync::Arc;
use crate::{
style::WidgetVisuals, text::LayoutJob, Align, Color32, FontFamily, FontSelection, Galley, Pos2,

2
egui/src/widgets/text_edit/builder.rs

@ -1,4 +1,4 @@
use epaint::mutex::Arc;
use std::sync::Arc;
use epaint::text::{cursor::*, Galley, LayoutJob};

12
epaint/src/mutex.rs

@ -142,11 +142,6 @@ mod rw_lock_impl {
}
}
#[cfg(not(target_arch = "wasm32"))]
mod arc_impl {
pub use std::sync::Arc;
}
// ----------------------------------------------------------------------------
#[cfg(target_arch = "wasm32")]
@ -211,15 +206,8 @@ mod rw_lock_impl {
}
}
#[cfg(target_arch = "wasm32")]
mod arc_impl {
// pub use std::rc::Rc as Arc; // TODO(emilk): optimize single threaded code by using `Rc` instead of `Arc`.
pub use std::sync::Arc;
}
// ----------------------------------------------------------------------------
pub use arc_impl::Arc;
pub use mutex_impl::{Mutex, MutexGuard};
pub use rw_lock_impl::{RwLock, RwLockReadGuard, RwLockWriteGuard};

18
epaint/src/shape.rs

@ -1,5 +1,7 @@
//! The different shapes that can be painted.
use std::sync::Arc;
use crate::{
text::{FontId, Fonts, Galley},
Color32, Mesh, Stroke, TextureId,
@ -175,17 +177,13 @@ impl Shape {
}
#[inline]
pub fn galley(pos: Pos2, galley: crate::mutex::Arc<Galley>) -> Self {
pub fn galley(pos: Pos2, galley: Arc<Galley>) -> Self {
TextShape::new(pos, galley).into()
}
#[inline]
/// The text color in the [`Galley`] will be replaced with the given color.
pub fn galley_with_color(
pos: Pos2,
galley: crate::mutex::Arc<Galley>,
text_color: Color32,
) -> Self {
pub fn galley_with_color(pos: Pos2, galley: Arc<Galley>, text_color: Color32) -> Self {
TextShape {
override_text_color: Some(text_color),
..TextShape::new(pos, galley)
@ -549,7 +547,7 @@ pub struct TextShape {
pub pos: Pos2,
/// The layed out text, from [`Fonts::layout_job`].
pub galley: crate::mutex::Arc<Galley>,
pub galley: Arc<Galley>,
/// Add this underline to the whole text.
/// You can also set an underline when creating the galley.
@ -567,7 +565,7 @@ pub struct TextShape {
impl TextShape {
#[inline]
pub fn new(pos: Pos2, galley: crate::mutex::Arc<Galley>) -> Self {
pub fn new(pos: Pos2, galley: Arc<Galley>) -> Self {
Self {
pos,
galley,
@ -734,7 +732,7 @@ pub struct PaintCallback {
///
/// The rendering backend is also responsible for restoring any state,
/// such as the bound shader program and vertex array.
pub callback: std::sync::Arc<dyn Fn(&PaintCallbackInfo, &dyn std::any::Any) + Send + Sync>,
pub callback: Arc<dyn Fn(&PaintCallbackInfo, &dyn std::any::Any) + Send + Sync>,
}
impl PaintCallback {
@ -758,7 +756,7 @@ impl std::cmp::PartialEq for PaintCallback {
// can only happen if we do dynamic casts back and forth on the pointers, and we don't do that.
#[allow(clippy::vtable_address_comparisons)]
{
self.rect.eq(&other.rect) && std::sync::Arc::ptr_eq(&self.callback, &other.callback)
self.rect.eq(&other.rect) && Arc::ptr_eq(&self.callback, &other.callback)
}
}
}

3
epaint/src/text/font.rs

@ -1,10 +1,11 @@
use crate::{
mutex::{Arc, Mutex, RwLock},
mutex::{Mutex, RwLock},
TextureAtlas,
};
use ahash::AHashMap;
use emath::{vec2, Vec2};
use std::collections::BTreeSet;
use std::sync::Arc;
// ----------------------------------------------------------------------------

3
epaint/src/text/fonts.rs

@ -1,7 +1,8 @@
use std::collections::BTreeMap;
use std::sync::Arc;
use crate::{
mutex::{Arc, Mutex, MutexGuard},
mutex::{Mutex, MutexGuard},
text::{
font::{Font, FontImpl},
Galley, LayoutJob,

3
epaint/src/text/text_layout.rs

@ -1,7 +1,8 @@
use std::ops::RangeInclusive;
use std::sync::Arc;
use super::{FontsImpl, Galley, Glyph, LayoutJob, LayoutSection, Row, RowVisuals};
use crate::{mutex::Arc, Color32, Mesh, Stroke, Vertex};
use crate::{Color32, Mesh, Stroke, Vertex};
use emath::*;
// ----------------------------------------------------------------------------

3
epaint/src/text/text_layout_types.rs

@ -1,9 +1,10 @@
#![allow(clippy::derive_hash_xor_eq)] // We need to impl Hash for f32, but we don't implement Eq, which is fine
use std::ops::Range;
use std::sync::Arc;
use super::{cursor::*, font::UvRect};
use crate::{mutex::Arc, Color32, FontId, Mesh, Stroke};
use crate::{Color32, FontId, Mesh, Stroke};
use emath::*;
/// Describes the task of laying out text.

8
epaint/src/texture_handle.rs

@ -1,8 +1,6 @@
use crate::{
emath::NumExt,
mutex::{Arc, RwLock},
ImageData, ImageDelta, TextureId, TextureManager,
};
use std::sync::Arc;
use crate::{emath::NumExt, mutex::RwLock, ImageData, ImageDelta, TextureId, TextureManager};
/// Used to paint images.
///

Loading…
Cancel
Save