Shape

Struct Shape 

Source
pub struct Shape<T, const KIND: u8> { /* private fields */ }

Implementations§

Source§

impl<T: Padded + 'static> Shape<T, { _ }>

Source

pub fn new( id: Arc<SourceID>, props: T, border: f32, blur: f32, corners: f32x4, fill: sRGB, outline: sRGB, size: DAbsPoint, ) -> Self

Examples found in repository?
examples/paragraph-rs.rs (lines 114-125)
106    fn call(
107        &mut self,
108        mut store: Self::Store,
109        args: Blocker,
110        mut scope: ScopeID<'_>,
111    ) -> (Self::Store, im::HashMap<Arc<SourceID>, Option<Window>>) {
112        if store.0 != args {
113            let flex = {
114                let rect = Shape::<MinimalFlexChild, { ShapeKind::RoundRect as u8 }>::new(
115                    gen_id!(scope),
116                    MinimalFlexChild {
117                        area: AbsRect::new(0.0, 0.0, 40.0, 40.0).into(),
118                    },
119                    0.0,
120                    0.0,
121                    wide::f32x4::splat(10.0),
122                    sRGB::new(0.2, 0.7, 0.4, 1.0),
123                    sRGB::transparent(),
124                    feather_ui::DAbsPoint::zero(),
125                );
126
127                let mut p = Paragraph::new(
128                    gen_id!(scope),
129                    MinimalFlex {
130                        area: FILL_DRECT,
131                        obstacles: vec![AbsRect::new(200.0, 30.0, 300.0, 150.0).into()],
132                    },
133                );
134
135                let text = "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?";
136                p.set_text(
137                    text,
138                    40.0,
139                    56.0,
140                    cosmic_text::FamilyOwned::SansSerif,
141                    sRGB::white(),
142                    Default::default(),
143                    Default::default(),
144                    true,
145                );
146                p.prepend(Box::new(rect.clone()));
147                p.append(Box::new(rect.clone()));
148                p.append(Box::new(rect.clone()));
149
150                p
151            };
152
153            let region = Region::new(
154                gen_id!(scope),
155                MinimalArea {
156                    area: AbsRect::new(90.0, 90.0, -90.0, -90.0) + RelRect::new(0.0, 0.0, 1.0, 1.0),
157                },
158                feather_ui::children![fixed::Prop, flex],
159            );
160
161            let window = Window::new(
162                gen_id!(scope),
163                winit::window::Window::default_attributes()
164                    .with_title(env!("CARGO_CRATE_NAME"))
165                    .with_resizable(true),
166                Box::new(region),
167            );
168
169            store.1 = im::HashMap::new();
170            store.1.insert(window.id.clone(), Some(window));
171            store.0 = args.clone();
172        }
173        let windows = store.1.clone();
174        (store, windows)
175    }
More examples
Hide additional examples
examples/grid-rs.rs (lines 134-143)
109    fn call(
110        &mut self,
111        mut store: Self::Store,
112        args: CounterState,
113        mut scope: ScopeID<'_>,
114    ) -> (Self::Store, im::HashMap<Arc<SourceID>, Option<Window>>) {
115        if store.0 != args {
116            let button = {
117                let text = {
118                    Text::<FixedData> {
119                        id: scope.create(),
120                        props: FixedData {
121                            area: AbsRect::new(10.0, 15.0, 10.0, 15.0)
122                                + RelRect::new(0.0, 0.0, UNSIZED_AXIS, UNSIZED_AXIS),
123                            anchor: feather_ui::RelPoint::zero().into(),
124                            ..Default::default()
125                        }
126                        .into(),
127                        text: format!("Boxes: {}", args.count),
128                        font_size: 40.0,
129                        line_height: 56.0,
130                        ..Default::default()
131                    }
132                };
133
134                let rect = Shape::<DRect, { ShapeKind::RoundRect as u8 }>::new(
135                    scope.create(),
136                    feather_ui::FILL_DRECT,
137                    0.0,
138                    0.0,
139                    wide::f32x4::splat(10.0),
140                    sRGB::new(0.2, 0.7, 0.4, 1.0),
141                    sRGB::transparent(),
142                    DAbsPoint::zero(),
143                );
144
145                Button::<FixedData>::new(
146                    scope.create(),
147                    FixedData {
148                        area: AbsRect::new(0.0, 20.0, 0.0, 0.0)
149                            + RelRect::new(0.5, 0.0, UNSIZED_AXIS, UNSIZED_AXIS),
150                        anchor: feather_ui::RelPoint::new(0.5, 0.0).into(),
151                        zindex: 0,
152                    },
153                    Slot(feather_ui::APP_SOURCE_ID.into(), 0),
154                    feather_ui::children![fixed::Prop, rect, text],
155                )
156            };
157
158            const NUM_COLUMNS: usize = 5;
159            let rectgrid = {
160                let mut children: im::Vector<Option<Box<ChildOf<dyn grid::Prop>>>> =
161                    im::Vector::new();
162                {
163                    for (i, id) in scope.iter(0..args.count) {
164                        children.push_back(Some(Box::new(Shape::<
165                            GridChild,
166                            { ShapeKind::RoundRect as u8 },
167                        >::new(
168                            id,
169                            GridChild {
170                                area: FILL_DRECT,
171                                x: i % NUM_COLUMNS,
172                                y: i / NUM_COLUMNS,
173                            },
174                            0.0,
175                            0.0,
176                            wide::f32x4::splat(4.0),
177                            sRGB::new(
178                                (0.1 * i as f32) % 1.0,
179                                (0.65 * i as f32) % 1.0,
180                                (0.2 * i as f32) % 1.0,
181                                1.0,
182                            ),
183                            sRGB::transparent(),
184                            DAbsPoint::zero(),
185                        ))));
186                    }
187                }
188
189                GridBox::<GridData>::new(
190                    scope.create(),
191                    GridData {
192                        area: AbsRect::new(0.0, 200.0, 0.0, 0.0)
193                            + RelRect::new(0.0, 0.0, UNSIZED_AXIS, 1.0),
194
195                        rlimits: feather_ui::RelLimits::new(0.0..1.0, 0.0..),
196                        direction: feather_ui::RowDirection::LeftToRight,
197                        rows: [40.0, 20.0, 40.0, 20.0, 40.0, 20.0, 10.0]
198                            .map(DValue::from)
199                            .to_vec(),
200                        columns: [80.0, 40.0, 80.0, 40.0, 80.0].map(DValue::from).to_vec(),
201                        spacing: AbsPoint::new(4.0, 4.0).into(),
202                        padding: AbsRect::new(8.0, 8.0, 8.0, 8.0).into(),
203                    },
204                    children,
205                )
206            };
207
208            let region = Region::new(
209                scope.create(),
210                FixedData {
211                    area: FILL_DRECT,
212                    zindex: 0,
213                    ..Default::default()
214                },
215                feather_ui::children![fixed::Prop, button, rectgrid],
216            );
217            let window = Window::new(
218                scope.create(),
219                winit::window::Window::default_attributes()
220                    .with_title(env!("CARGO_CRATE_NAME"))
221                    .with_resizable(true),
222                Box::new(region),
223            );
224
225            store.1 = im::HashMap::new();
226            store.1.insert(window.id.clone(), Some(window));
227            store.0 = args.clone();
228        }
229        let windows = store.1.clone();
230        (store, windows)
231    }
examples/image-rs.rs (lines 51-60)
45    fn call(
46        &mut self,
47        _: Self::Store,
48        _: (),
49        mut scope: ScopeID<'_>,
50    ) -> (Self::Store, im::HashMap<Arc<SourceID>, Option<Window>>) {
51        let pixel = Shape::<DRect, { ShapeKind::RoundRect as u8 }>::new(
52            scope.create(),
53            PxRect::new(1.0, 1.0, 2.0, 2.0).into(),
54            0.0,
55            0.0,
56            wide::f32x4::splat(0.0),
57            sRGB::new(1.0, 1.0, 1.0, 1.0),
58            sRGB::transparent(),
59            feather_ui::DAbsPoint::zero(),
60        );
61
62        let mut children: im::Vector<Option<Box<feather_ui::component::ChildOf<dyn fixed::Prop>>>> =
63            im::Vector::new();
64        children.push_back(Some(Box::new(pixel)));
65
66        let mut genimage = |pos: AbsPoint,
67                            w: Option<f32>,
68                            h: Option<f32>,
69                            res: &dyn feather_ui::resource::Location,
70                            size: Option<AbsPoint>| {
71            Image::<DRect>::new(
72                scope.create(),
73                AbsRect::new(
74                    pos.x,
75                    pos.y,
76                    w.map(|x| x + pos.x).unwrap_or_default(),
77                    h.map(|y| y + pos.y).unwrap_or_default(),
78                ) + RelRect::new(
79                    0.0,
80                    0.0,
81                    if w.is_none() { UNSIZED_AXIS } else { 0.0 },
82                    if h.is_none() { UNSIZED_AXIS } else { 0.0 },
83                ),
84                res,
85                size.unwrap_or_default().into(),
86                false,
87            )
88        };
89
90        #[cfg(feature = "png")]
91        {
92            let testimage = PathBuf::from("./premul_test.png");
93
94            children.push_back(Some(Box::new(genimage(
95                AbsPoint::new(0.0, 0.0),
96                Some(100.0),
97                Some(100.0),
98                &testimage,
99                None,
100            ))));
101
102            children.push_back(Some(Box::new(genimage(
103                AbsPoint::new(100.0, 0.0),
104                None,
105                Some(100.0),
106                &testimage,
107                None,
108            ))));
109
110            children.push_back(Some(Box::new(genimage(
111                AbsPoint::new(0.0, 100.0),
112                None,
113                None,
114                &testimage,
115                Some(AbsPoint::new(100.0, 100.0)),
116            ))));
117
118            children.push_back(Some(Box::new(genimage(
119                AbsPoint::new(100.0, 100.0),
120                None,
121                None,
122                &testimage,
123                None,
124            ))));
125        }
126
127        #[cfg(feature = "svg")]
128        {
129            let testsvg = PathBuf::from("./FRI_logo.svg");
130
131            children.push_back(Some(Box::new(genimage(
132                AbsPoint::new(200.0, 0.0),
133                Some(100.0),
134                Some(100.0),
135                &testsvg,
136                None,
137            ))));
138
139            children.push_back(Some(Box::new(genimage(
140                AbsPoint::new(300.0, 0.0),
141                None,
142                Some(100.0),
143                &testsvg,
144                None,
145            ))));
146
147            children.push_back(Some(Box::new(genimage(
148                AbsPoint::new(200.0, 100.0),
149                None,
150                None,
151                &testsvg,
152                Some(AbsPoint::new(100.0, 100.0)),
153            ))));
154
155            children.push_back(Some(Box::new(genimage(
156                AbsPoint::new(300.0, 100.0),
157                None,
158                None,
159                &testsvg,
160                None,
161            ))));
162        }
163
164        #[cfg(feature = "png")]
165        {
166            let testimage = PathBuf::from("./test_color.png");
167
168            children.push_back(Some(Box::new(genimage(
169                AbsPoint::new(0.0, 200.0),
170                Some(100.0),
171                Some(100.0),
172                &testimage,
173                None,
174            ))));
175
176            children.push_back(Some(Box::new(genimage(
177                AbsPoint::new(100.0, 200.0),
178                Some(100.0),
179                None,
180                &testimage,
181                None,
182            ))));
183
184            children.push_back(Some(Box::new(genimage(
185                AbsPoint::new(0.0, 300.0),
186                None,
187                None,
188                &testimage,
189                Some(AbsPoint::new(100.0, 100.0)),
190            ))));
191
192            children.push_back(Some(Box::new(genimage(
193                AbsPoint::new(100.0, 300.0),
194                None,
195                None,
196                &testimage,
197                None,
198            ))));
199        }
200
201        #[cfg(feature = "jxl")]
202        {
203            let testimage = PathBuf::from("./dice.jxl");
204
205            children.push_back(Some(Box::new(genimage(
206                AbsPoint::new(200.0, 200.0),
207                Some(100.0),
208                Some(100.0),
209                &testimage,
210                None,
211            ))));
212
213            children.push_back(Some(Box::new(genimage(
214                AbsPoint::new(300.0, 200.0),
215                Some(100.0),
216                None,
217                &testimage,
218                None,
219            ))));
220
221            children.push_back(Some(Box::new(genimage(
222                AbsPoint::new(200.0, 300.0),
223                None,
224                None,
225                &testimage,
226                Some(AbsPoint::new(100.0, 100.0)),
227            ))));
228
229            children.push_back(Some(Box::new(genimage(
230                AbsPoint::new(300.0, 300.0),
231                None,
232                None,
233                &testimage,
234                None,
235            ))));
236        }
237
238        let region = Region::new(
239            gen_id!(scope),
240            FixedData {
241                area: AbsRect::new(10.0, 10.0, -10.0, -10.0) + RelRect::new(0.0, 0.0, 1.0, 1.0),
242
243                zindex: 0,
244                ..Default::default()
245            },
246            children,
247        );
248
249        #[cfg(feature = "svg")]
250        let icon = Some(
251            feather_ui::resource::load_icon(&std::path::PathBuf::from("./FRI_logo.svg")).unwrap(),
252        );
253        #[cfg(not(feature = "svg"))]
254        let icon = None;
255
256        let window = Window::new(
257            gen_id!(scope),
258            winit::window::Window::default_attributes()
259                .with_title(env!("CARGO_CRATE_NAME"))
260                .with_resizable(true)
261                .with_window_icon(icon),
262            Box::new(region),
263        );
264
265        let mut store = im::HashMap::new();
266        store.insert(window.id.clone(), Some(window));
267        let windows = store.clone();
268        (store, windows)
269    }
examples/list-rs.rs (lines 156-165)
132    fn call(
133        &mut self,
134        mut store: Self::Store,
135        args: CounterState,
136        mut scope: ScopeID<'_>,
137    ) -> (Self::Store, im::HashMap<Arc<SourceID>, Option<Window>>) {
138        if store.0 != args {
139            let button = {
140                let text = Text::<FixedData> {
141                    id: gen_id!(scope),
142                    props: FixedData {
143                        area: AbsRect::new(10.0, 15.0, 10.0, 15.0)
144                            + RelRect::new(0.0, 0.0, UNSIZED_AXIS, UNSIZED_AXIS),
145
146                        anchor: feather_ui::RelPoint::new(0.0, 0.0).into(),
147                        ..Default::default()
148                    }
149                    .into(),
150                    text: format!("Boxes: {}", args.count),
151                    font_size: 40.0,
152                    line_height: 56.0,
153                    ..Default::default()
154                };
155
156                let rect = Shape::<DRect, { ShapeKind::RoundRect as u8 }>::new(
157                    gen_id!(scope),
158                    feather_ui::FILL_DRECT,
159                    0.0,
160                    0.0,
161                    wide::f32x4::splat(10.0),
162                    sRGB::new(0.2, 0.7, 0.4, 1.0),
163                    sRGB::transparent(),
164                    DAbsPoint::zero(),
165                );
166
167                Button::<FixedData>::new(
168                    gen_id!(scope),
169                    FixedData {
170                        area: AbsRect::new(0.0, 20.0, 0.0, 0.0)
171                            + RelRect::new(0.5, 0.0, UNSIZED_AXIS, UNSIZED_AXIS),
172
173                        anchor: feather_ui::RelPoint::new(0.5, 0.0).into(),
174                        zindex: 0,
175                    },
176                    Slot(feather_ui::APP_SOURCE_ID.into(), 0),
177                    feather_ui::children![fixed::Prop, rect, text],
178                )
179            };
180
181            let rectlist = {
182                let mut children: im::Vector<Option<Box<ChildOf<dyn list::Prop>>>> =
183                    im::Vector::new();
184
185                for (i, id) in scope.iter(0..args.count) {
186                    children.push_back(Some(Box::new(Shape::<
187                        ListChild,
188                        { ShapeKind::RoundRect as u8 },
189                    >::new(
190                        id,
191                        ListChild {
192                            area: AbsRect::new(0.0, 0.0, 40.0, 40.0).into(),
193                            margin: AbsRect::new(8.0, 8.0, 4.0, 4.0).into(),
194                        },
195                        0.0,
196                        0.0,
197                        wide::f32x4::splat(8.0),
198                        sRGB::new(
199                            (0.1 * i as f32) % 1.0,
200                            (0.65 * i as f32) % 1.0,
201                            (0.2 * i as f32) % 1.0,
202                            1.0,
203                        ),
204                        sRGB::transparent(),
205                        DAbsPoint::zero(),
206                    ))));
207                }
208
209                ListBox::<ListData>::new(
210                    gen_id!(scope),
211                    ListData {
212                        area: AbsRect::new(0.0, 200.0, 0.0, 0.0)
213                            + RelRect::new(0.0, 0.0, UNSIZED_AXIS, 1.0),
214
215                        rlimits: feather_ui::RelLimits::new(0.0..1.0, 0.0..),
216                        direction: feather_ui::RowDirection::BottomToTop,
217                    },
218                    children,
219                )
220            };
221
222            let flexlist = {
223                let mut children: im::Vector<Option<Box<ChildOf<dyn flex::Prop>>>> =
224                    im::Vector::new();
225
226                for (i, id) in scope.iter(0..args.count) {
227                    let rect = Shape::<FlexChild, { ShapeKind::RoundRect as u8 }>::new(
228                        gen_id!(id),
229                        FlexChild {
230                            area: AbsRect::new(0.0, 0.0, 0.0, 40.0)
231                                + RelRect::new(0.0, 0.0, 1.0, 0.0),
232
233                            margin: AbsRect::new(8.0, 8.0, 4.0, 4.0).into(),
234                            basis: 40.0.into(),
235                            grow: 0.0,
236                            shrink: 0.0,
237                        },
238                        0.0,
239                        0.0,
240                        wide::f32x4::splat(8.0),
241                        sRGB::new(
242                            (0.1 * i as f32) % 1.0,
243                            (0.65 * i as f32) % 1.0,
244                            (0.2 * i as f32) % 1.0,
245                            1.0,
246                        ),
247                        sRGB::transparent(),
248                        DAbsPoint::zero(),
249                    );
250
251                    // We include a "useless" region around the rectangle because this catches some edge cases
252                    // in the layout logic.
253                    let reg = Region::<FlexChild>::new(
254                        id,
255                        FlexChild {
256                            area: AbsRect::new(0.0, 0.0, 0.0, 40.0)
257                                + RelRect::new(0.0, 0.0, 1.0, 0.0),
258
259                            margin: AbsRect::new(8.0, 8.0, 4.0, 4.0).into(),
260                            basis: 40.0.into(),
261                            grow: 0.0,
262                            shrink: 0.0,
263                        },
264                        feather_ui::children![fixed::Prop, rect],
265                    );
266
267                    children.push_back(Some(Box::new(reg)));
268                }
269
270                FlexBox::<MinimalFlex>::new(
271                    gen_id!(scope),
272                    MinimalFlex {
273                        area: (AbsRect::new(40.0, 40.0, 0.0, 200.0)
274                            + RelRect::new(0.0, 0.0, 1.0, 0.0)),
275                    },
276                    children,
277                )
278            };
279
280            let region = Region::new(
281                gen_id!(scope),
282                FixedData {
283                    area: FILL_DRECT,
284                    zindex: 0,
285                    ..Default::default()
286                },
287                feather_ui::children![fixed::Prop, button, flexlist, rectlist],
288            );
289            let window = Window::new(
290                gen_id!(scope),
291                feather_ui::winit::window::Window::default_attributes()
292                    .with_title(env!("CARGO_CRATE_NAME"))
293                    .with_resizable(true),
294                Box::new(region),
295            );
296
297            store.1 = im::HashMap::new();
298            store.1.insert(window.id.clone(), Some(window));
299            store.0 = args.clone();
300        }
301        let windows = store.1.clone();
302        (store, windows)
303    }
Source§

impl<T: Padded + 'static> Shape<T, { _ }>

Source

pub fn new( id: Arc<SourceID>, props: T, border: f32, blur: f32, corners: [f32; 3], offset: f32, fill: sRGB, outline: sRGB, size: DAbsPoint, ) -> Self

Source§

impl<T: Padded + 'static> Shape<T, { _ }>

Source

pub fn new( id: Arc<SourceID>, props: T, border: f32, blur: f32, radii: [f32; 2], fill: sRGB, outline: sRGB, size: DAbsPoint, ) -> Self

Examples found in repository?
examples/graph-rs.rs (lines 78-91)
59    fn call(
60        &mut self,
61        mut store: Self::Store,
62        args: GraphState,
63        mut scope: ScopeID<'_>,
64    ) -> (Self::Store, im::HashMap<Arc<SourceID>, Option<Window>>) {
65        if store.0 != args {
66            let mut children: im::Vector<Option<Box<ChildOf<dyn fixed::Prop>>>> = im::Vector::new();
67            let domain: Arc<CrossReferenceDomain> = Default::default();
68
69            let mut node_ids: Vec<Arc<SourceID>> = Vec::new();
70
71            for (i, id) in scope.iter(0..args.nodes.len()) {
72                let node = args.nodes[i];
73                const BASE: sRGB = sRGB::new(0.2, 0.7, 0.4, 1.0);
74
75                let point = DomainPoint::new(id, domain.clone());
76                node_ids.push(point.id.clone());
77
78                let circle = Shape::<DRect, { ShapeKind::Circle as u8 }>::new(
79                    gen_id!(point.id),
80                    FILL_DRECT,
81                    0.0,
82                    0.0,
83                    [0.0, 20.0],
84                    if args.selected == Some(i) {
85                        sRGB::new(0.7, 1.0, 0.8, 1.0)
86                    } else {
87                        BASE
88                    },
89                    BASE,
90                    DAbsPoint::zero(),
91                );
92
93                let bag = Region::<MinimalArea>::new(
94                    gen_id!(point.id),
95                    MinimalArea {
96                        area: AbsRect::new(
97                            node.x - NODE_RADIUS,
98                            node.y - NODE_RADIUS,
99                            node.x + NODE_RADIUS,
100                            node.y + NODE_RADIUS,
101                        )
102                        .into(),
103                    },
104                    feather_ui::children![fixed::Prop, point, circle],
105                );
106
107                children.push_back(Some(Box::new(bag)));
108            }
109
110            for ((a, b), id) in scope.iter(&args.edges) {
111                let line = DomainLine::<()> {
112                    id,
113                    fill: sRGB::white(),
114                    domain: domain.clone(),
115                    start: node_ids[*a].clone(),
116                    end: node_ids[*b].clone(),
117                    props: ().into(),
118                };
119
120                children.push_back(Some(Box::new(line)));
121            }
122
123            let subregion = Region::new(
124                gen_id!(scope),
125                MinimalArea {
126                    area: AbsRect::new(
127                        args.offset.x,
128                        args.offset.y,
129                        args.offset.x + 10000.0,
130                        args.offset.y + 10000.0,
131                    )
132                    .into(),
133                },
134                children,
135            );
136
137            let mousearea: MouseArea<MinimalArea> = MouseArea::new(
138                gen_id!(scope),
139                MinimalArea { area: FILL_DRECT },
140                Some(4.0),
141                [
142                    Some(Slot(feather_ui::APP_SOURCE_ID.into(), 0)),
143                    Some(Slot(feather_ui::APP_SOURCE_ID.into(), 0)),
144                    Some(Slot(feather_ui::APP_SOURCE_ID.into(), 0)),
145                    None,
146                    None,
147                    None,
148                ],
149            );
150
151            let region = Region::new(
152                gen_id!(scope),
153                MinimalArea { area: FILL_DRECT },
154                feather_ui::children![fixed::Prop, subregion, mousearea],
155            );
156
157            let window = Window::new(
158                gen_id!(scope),
159                feather_ui::winit::window::Window::default_attributes()
160                    .with_title(env!("CARGO_CRATE_NAME"))
161                    .with_resizable(true),
162                Box::new(region),
163            );
164
165            store.1 = im::HashMap::new();
166            store.1.insert(window.id.clone(), Some(window));
167            store.0 = args.clone();
168        }
169        let windows = store.1.clone();
170        (store, windows)
171    }
Source§

impl<T: Padded + 'static> Shape<T, { _ }>

Source

pub fn new( id: Arc<SourceID>, props: T, border: f32, blur: f32, inner_radius: f32, arcs: [f32; 2], fill: sRGB, outline: sRGB, size: DAbsPoint, ) -> Self

Trait Implementations§

Source§

impl<T: Padded + 'static, const KIND: u8> Clone for Shape<T, KIND>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Padded + 'static, const KIND: u8> Component for Shape<T, KIND>
where for<'a> &'a T: Into<&'a (dyn Padded + 'static)>,

Source§

type Props = T

Source§

fn layout( &self, manager: &mut StateManager, _: &Driver, window: &Arc<SourceID>, ) -> Box<dyn Layout<T>>

Source§

impl<T: Padded + 'static, const KIND: u8> StateMachineChild for Shape<T, KIND>

Source§

fn id(&self) -> Arc<SourceID>

Source§

fn init( &self, driver: &Weak<Driver>, ) -> Result<Box<dyn StateMachineWrapper>, Error>

Source§

fn apply_children( &self, _: &mut dyn FnMut(&dyn StateMachineChild) -> Result<()>, ) -> Result<()>

Auto Trait Implementations§

§

impl<T, const KIND: u8> Freeze for Shape<T, KIND>

§

impl<T, const KIND: u8> !RefUnwindSafe for Shape<T, KIND>

§

impl<T, const KIND: u8> !Send for Shape<T, KIND>

§

impl<T, const KIND: u8> !Sync for Shape<T, KIND>

§

impl<T, const KIND: u8> Unpin for Shape<T, KIND>

§

impl<T, const KIND: u8> !UnwindSafe for Shape<T, KIND>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<U, C> ComponentWrap<U> for C
where C: Component, &'a U: for<'a> From<&'a <C as Component>::Props>, <C as Component>::Props: Sized, U: ?Sized,

Source§

fn layout( &self, state: &mut StateManager, driver: &Driver, window: &Arc<SourceID>, ) -> Box<dyn Layout<U>>

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> MaybeSend for T