Add a proc macro for deriving override structs with optional fields
This commit is contained in:
parent
b95b2af3e0
commit
ab9356e9d8
9 changed files with 209 additions and 96 deletions
|
@ -1,4 +1,4 @@
|
|||
use crate::element::{Element, ElementMetadata, EventHandler, IntoElement};
|
||||
use crate::element::{Element, ElementMetadata, IntoElement};
|
||||
use gpui::{geometry::Size, text_layout::LineLayout, RenderContext};
|
||||
use parking_lot::Mutex;
|
||||
use std::sync::Arc;
|
||||
|
@ -22,8 +22,8 @@ pub struct Text<V> {
|
|||
impl<V: 'static> Element<V> for Text<V> {
|
||||
type Layout = Arc<Mutex<Option<TextLayout>>>;
|
||||
|
||||
fn style_mut(&mut self) -> &mut crate::style::ElementStyle {
|
||||
&mut self.metadata.style
|
||||
fn metadata(&mut self) -> &mut crate::element::ElementMetadata<V> {
|
||||
&mut self.metadata
|
||||
}
|
||||
|
||||
fn layout(
|
||||
|
@ -91,10 +91,6 @@ impl<V: 'static> Element<V> for Text<V> {
|
|||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handlers_mut(&mut self) -> &mut Vec<EventHandler<V>> {
|
||||
&mut self.metadata.handlers
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TextLayout {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue