1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 22:30:03 -04:00
This commit is contained in:
Lucas Meurer
2026-08-31 16:20:47 +02:00
parent d6f507c448
commit e0db1f2705

View File

@@ -1,10 +1,9 @@
use core::borrow::Borrow;
use smallvec::SmallVec; use smallvec::SmallVec;
use std::borrow::{Borrow, Cow}; use std::borrow::Cow;
use std::fmt; use std::fmt;
use std::sync::Arc; use std::sync::Arc;
use crate::TextBuffer as _;
/// A class, used to customize widget styling and behavior. /// A class, used to customize widget styling and behavior.
#[derive(Clone)] #[derive(Clone)]
pub struct ClassName(ClassNameInner); pub struct ClassName(ClassNameInner);
@@ -24,7 +23,7 @@ impl ClassName {
/// A class from anything that converts into one. /// A class from anything that converts into one.
#[inline] #[inline]
pub fn new(class: impl Into<ClassName>) -> Self { pub fn new(class: impl Into<Self>) -> Self {
class.into() class.into()
} }
@@ -76,9 +75,9 @@ impl From<Cow<'static, str>> for ClassName {
} }
} }
impl From<&ClassName> for ClassName { impl From<&Self> for ClassName {
#[inline] #[inline]
fn from(class: &ClassName) -> Self { fn from(class: &Self) -> Self {
class.clone() class.clone()
} }
} }
@@ -97,7 +96,7 @@ impl AsRef<str> for ClassName {
} }
} }
impl std::ops::Deref for ClassName { impl core::ops::Deref for ClassName {
type Target = str; type Target = str;
#[inline] #[inline]
@@ -129,9 +128,9 @@ impl PartialEq<&str> for ClassName {
} }
} }
impl std::hash::Hash for ClassName { impl core::hash::Hash for ClassName {
#[inline] #[inline]
fn hash<H: std::hash::Hasher>(&self, state: &mut H) { fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
self.as_str().hash(state); self.as_str().hash(state);
} }
} }