html/generated/
menu.rs

1pub mod element {
2    /// The HTML `<menu>` element
3    ///
4    /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/menu)
5    #[doc(alias = "menu")]
6    #[non_exhaustive]
7    #[derive(PartialEq, Clone, Default)]
8    pub struct Menu {
9        sys: html_sys::text::Menu,
10        children: Vec<super::child::MenuChild>,
11    }
12    impl Menu {
13        /// Create a new builder
14        pub fn builder() -> super::builder::MenuBuilder {
15            super::builder::MenuBuilder::new(Default::default())
16        }
17    }
18    impl Menu {
19        /// Access the element's `data-*` properties
20        pub fn data_map(&self) -> &html_sys::DataMap {
21            &self.sys.data_map
22        }
23        /// Mutably access the element's `data-*` properties
24        pub fn data_map_mut(&mut self) -> &mut html_sys::DataMap {
25            &mut self.sys.data_map
26        }
27    }
28    impl Menu {
29        /// Get the value of the `role` attribute
30        pub fn role(&self) -> std::option::Option<&str> {
31            self.sys.role.as_deref()
32        }
33        /// Set the value of the `role` attribute
34        pub fn set_role(
35            &mut self,
36            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
37        ) {
38            self.sys.role = value.map(|v| v.into());
39        }
40        /// Get the value of the `aria-activedescendant` attribute
41        pub fn aria_active_descendant_element(&self) -> std::option::Option<&str> {
42            self.sys.aria_active_descendant_element.as_deref()
43        }
44        /// Set the value of the `aria-activedescendant` attribute
45        pub fn set_aria_active_descendant_element(
46            &mut self,
47            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
48        ) {
49            self.sys.aria_active_descendant_element = value.map(|v| v.into());
50        }
51        /// Get the value of the `aria-atomic` attribute
52        pub fn aria_atomic(&self) -> bool {
53            self.sys.aria_atomic
54        }
55        /// Set the value of the `aria-atomic` attribute
56        pub fn set_aria_atomic(&mut self, value: bool) {
57            self.sys.aria_atomic = value;
58        }
59        /// Get the value of the `aria-braillelabel` attribute
60        pub fn aria_braille_label(&self) -> std::option::Option<&str> {
61            self.sys.aria_braille_label.as_deref()
62        }
63        /// Set the value of the `aria-braillelabel` attribute
64        pub fn set_aria_braille_label(
65            &mut self,
66            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
67        ) {
68            self.sys.aria_braille_label = value.map(|v| v.into());
69        }
70        /// Get the value of the `aria-brailleroledescription` attribute
71        pub fn aria_braille_role_description(&self) -> std::option::Option<&str> {
72            self.sys.aria_braille_role_description.as_deref()
73        }
74        /// Set the value of the `aria-brailleroledescription` attribute
75        pub fn set_aria_braille_role_description(
76            &mut self,
77            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
78        ) {
79            self.sys.aria_braille_role_description = value.map(|v| v.into());
80        }
81        /// Get the value of the `aria-busy` attribute
82        pub fn aria_busy(&self) -> bool {
83            self.sys.aria_busy
84        }
85        /// Set the value of the `aria-busy` attribute
86        pub fn set_aria_busy(&mut self, value: bool) {
87            self.sys.aria_busy = value;
88        }
89        /// Get the value of the `aria-controls` attribute
90        pub fn aria_controls_elements(&self) -> std::option::Option<&str> {
91            self.sys.aria_controls_elements.as_deref()
92        }
93        /// Set the value of the `aria-controls` attribute
94        pub fn set_aria_controls_elements(
95            &mut self,
96            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
97        ) {
98            self.sys.aria_controls_elements = value.map(|v| v.into());
99        }
100        /// Get the value of the `aria-current` attribute
101        pub fn aria_current(&self) -> std::option::Option<&str> {
102            self.sys.aria_current.as_deref()
103        }
104        /// Set the value of the `aria-current` attribute
105        pub fn set_aria_current(
106            &mut self,
107            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
108        ) {
109            self.sys.aria_current = value.map(|v| v.into());
110        }
111        /// Get the value of the `aria-describedby` attribute
112        pub fn aria_described_by_elements(&self) -> std::option::Option<&str> {
113            self.sys.aria_described_by_elements.as_deref()
114        }
115        /// Set the value of the `aria-describedby` attribute
116        pub fn set_aria_described_by_elements(
117            &mut self,
118            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
119        ) {
120            self.sys.aria_described_by_elements = value.map(|v| v.into());
121        }
122        /// Get the value of the `aria-description` attribute
123        pub fn aria_description(&self) -> std::option::Option<&str> {
124            self.sys.aria_description.as_deref()
125        }
126        /// Set the value of the `aria-description` attribute
127        pub fn set_aria_description(
128            &mut self,
129            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
130        ) {
131            self.sys.aria_description = value.map(|v| v.into());
132        }
133        /// Get the value of the `aria-details` attribute
134        pub fn aria_details_elements(&self) -> std::option::Option<&str> {
135            self.sys.aria_details_elements.as_deref()
136        }
137        /// Set the value of the `aria-details` attribute
138        pub fn set_aria_details_elements(
139            &mut self,
140            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
141        ) {
142            self.sys.aria_details_elements = value.map(|v| v.into());
143        }
144        /// Get the value of the `aria-disabled` attribute
145        pub fn aria_disabled(&self) -> bool {
146            self.sys.aria_disabled
147        }
148        /// Set the value of the `aria-disabled` attribute
149        pub fn set_aria_disabled(&mut self, value: bool) {
150            self.sys.aria_disabled = value;
151        }
152        /// Get the value of the `aria-dropeffect` attribute
153        pub fn aria_drop_effect(&self) -> std::option::Option<&str> {
154            self.sys.aria_drop_effect.as_deref()
155        }
156        /// Set the value of the `aria-dropeffect` attribute
157        pub fn set_aria_drop_effect(
158            &mut self,
159            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
160        ) {
161            self.sys.aria_drop_effect = value.map(|v| v.into());
162        }
163        /// Get the value of the `aria-errormessage` attribute
164        pub fn aria_error_message_elements(&self) -> std::option::Option<&str> {
165            self.sys.aria_error_message_elements.as_deref()
166        }
167        /// Set the value of the `aria-errormessage` attribute
168        pub fn set_aria_error_message_elements(
169            &mut self,
170            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
171        ) {
172            self.sys.aria_error_message_elements = value.map(|v| v.into());
173        }
174        /// Get the value of the `aria-expanded` attribute
175        pub fn aria_expanded(&self) -> bool {
176            self.sys.aria_expanded
177        }
178        /// Set the value of the `aria-expanded` attribute
179        pub fn set_aria_expanded(&mut self, value: bool) {
180            self.sys.aria_expanded = value;
181        }
182        /// Get the value of the `aria-flowto` attribute
183        pub fn aria_flow_to_elements(&self) -> std::option::Option<&str> {
184            self.sys.aria_flow_to_elements.as_deref()
185        }
186        /// Set the value of the `aria-flowto` attribute
187        pub fn set_aria_flow_to_elements(
188            &mut self,
189            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
190        ) {
191            self.sys.aria_flow_to_elements = value.map(|v| v.into());
192        }
193        /// Get the value of the `aria-grabbed` attribute
194        pub fn aria_grabbed(&self) -> bool {
195            self.sys.aria_grabbed
196        }
197        /// Set the value of the `aria-grabbed` attribute
198        pub fn set_aria_grabbed(&mut self, value: bool) {
199            self.sys.aria_grabbed = value;
200        }
201        /// Get the value of the `aria-haspopup` attribute
202        pub fn aria_has_popup(&self) -> std::option::Option<&str> {
203            self.sys.aria_has_popup.as_deref()
204        }
205        /// Set the value of the `aria-haspopup` attribute
206        pub fn set_aria_has_popup(
207            &mut self,
208            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
209        ) {
210            self.sys.aria_has_popup = value.map(|v| v.into());
211        }
212        /// Get the value of the `aria-hidden` attribute
213        pub fn aria_hidden(&self) -> bool {
214            self.sys.aria_hidden
215        }
216        /// Set the value of the `aria-hidden` attribute
217        pub fn set_aria_hidden(&mut self, value: bool) {
218            self.sys.aria_hidden = value;
219        }
220        /// Get the value of the `aria-invalid` attribute
221        pub fn aria_invalid(&self) -> std::option::Option<&str> {
222            self.sys.aria_invalid.as_deref()
223        }
224        /// Set the value of the `aria-invalid` attribute
225        pub fn set_aria_invalid(
226            &mut self,
227            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
228        ) {
229            self.sys.aria_invalid = value.map(|v| v.into());
230        }
231        /// Get the value of the `aria-keyshortcuts` attribute
232        pub fn aria_key_shortcuts(&self) -> std::option::Option<&str> {
233            self.sys.aria_key_shortcuts.as_deref()
234        }
235        /// Set the value of the `aria-keyshortcuts` attribute
236        pub fn set_aria_key_shortcuts(
237            &mut self,
238            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
239        ) {
240            self.sys.aria_key_shortcuts = value.map(|v| v.into());
241        }
242        /// Get the value of the `aria-label` attribute
243        pub fn aria_label(&self) -> std::option::Option<&str> {
244            self.sys.aria_label.as_deref()
245        }
246        /// Set the value of the `aria-label` attribute
247        pub fn set_aria_label(
248            &mut self,
249            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
250        ) {
251            self.sys.aria_label = value.map(|v| v.into());
252        }
253        /// Get the value of the `aria-labelledby` attribute
254        pub fn aria_labelled_by_elements(&self) -> std::option::Option<&str> {
255            self.sys.aria_labelled_by_elements.as_deref()
256        }
257        /// Set the value of the `aria-labelledby` attribute
258        pub fn set_aria_labelled_by_elements(
259            &mut self,
260            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
261        ) {
262            self.sys.aria_labelled_by_elements = value.map(|v| v.into());
263        }
264        /// Get the value of the `aria-live` attribute
265        pub fn aria_live(&self) -> std::option::Option<&str> {
266            self.sys.aria_live.as_deref()
267        }
268        /// Set the value of the `aria-live` attribute
269        pub fn set_aria_live(
270            &mut self,
271            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
272        ) {
273            self.sys.aria_live = value.map(|v| v.into());
274        }
275        /// Get the value of the `aria-multiselectable` attribute
276        pub fn aria_multi_selectable(&self) -> bool {
277            self.sys.aria_multi_selectable
278        }
279        /// Set the value of the `aria-multiselectable` attribute
280        pub fn set_aria_multi_selectable(&mut self, value: bool) {
281            self.sys.aria_multi_selectable = value;
282        }
283        /// Get the value of the `aria-orientation` attribute
284        pub fn aria_orientation(&self) -> std::option::Option<&str> {
285            self.sys.aria_orientation.as_deref()
286        }
287        /// Set the value of the `aria-orientation` attribute
288        pub fn set_aria_orientation(
289            &mut self,
290            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
291        ) {
292            self.sys.aria_orientation = value.map(|v| v.into());
293        }
294        /// Get the value of the `aria-owns` attribute
295        pub fn aria_owns_elements(&self) -> std::option::Option<&str> {
296            self.sys.aria_owns_elements.as_deref()
297        }
298        /// Set the value of the `aria-owns` attribute
299        pub fn set_aria_owns_elements(
300            &mut self,
301            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
302        ) {
303            self.sys.aria_owns_elements = value.map(|v| v.into());
304        }
305        /// Get the value of the `aria-readonly` attribute
306        pub fn aria_read_only(&self) -> bool {
307            self.sys.aria_read_only
308        }
309        /// Set the value of the `aria-readonly` attribute
310        pub fn set_aria_read_only(&mut self, value: bool) {
311            self.sys.aria_read_only = value;
312        }
313        /// Get the value of the `aria-relevant` attribute
314        pub fn aria_relevant(&self) -> std::option::Option<&str> {
315            self.sys.aria_relevant.as_deref()
316        }
317        /// Set the value of the `aria-relevant` attribute
318        pub fn set_aria_relevant(
319            &mut self,
320            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
321        ) {
322            self.sys.aria_relevant = value.map(|v| v.into());
323        }
324        /// Get the value of the `aria-required` attribute
325        pub fn aria_required(&self) -> bool {
326            self.sys.aria_required
327        }
328        /// Set the value of the `aria-required` attribute
329        pub fn set_aria_required(&mut self, value: bool) {
330            self.sys.aria_required = value;
331        }
332        /// Get the value of the `aria-roledescription` attribute
333        pub fn aria_role_description(&self) -> std::option::Option<&str> {
334            self.sys.aria_role_description.as_deref()
335        }
336        /// Set the value of the `aria-roledescription` attribute
337        pub fn set_aria_role_description(
338            &mut self,
339            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
340        ) {
341            self.sys.aria_role_description = value.map(|v| v.into());
342        }
343        /// Get the value of the `accesskey` attribute
344        pub fn access_key(&self) -> std::option::Option<&str> {
345            self.sys.access_key.as_deref()
346        }
347        /// Set the value of the `accesskey` attribute
348        pub fn set_access_key(
349            &mut self,
350            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
351        ) {
352            self.sys.access_key = value.map(|v| v.into());
353        }
354        /// Get the value of the `autocapitalize` attribute
355        pub fn auto_capitalize(&self) -> std::option::Option<&str> {
356            self.sys.auto_capitalize.as_deref()
357        }
358        /// Set the value of the `autocapitalize` attribute
359        pub fn set_auto_capitalize(
360            &mut self,
361            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
362        ) {
363            self.sys.auto_capitalize = value.map(|v| v.into());
364        }
365        /// Get the value of the `autofocus` attribute
366        pub fn autofocus(&self) -> bool {
367            self.sys.autofocus
368        }
369        /// Set the value of the `autofocus` attribute
370        pub fn set_autofocus(&mut self, value: bool) {
371            self.sys.autofocus = value;
372        }
373        /// Get the value of the `class` attribute
374        pub fn class(&self) -> std::option::Option<&str> {
375            self.sys.class.as_deref()
376        }
377        /// Set the value of the `class` attribute
378        pub fn set_class(
379            &mut self,
380            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
381        ) {
382            self.sys.class = value.map(|v| v.into());
383        }
384        /// Get the value of the `contenteditable` attribute
385        pub fn content_editable(&self) -> std::option::Option<&str> {
386            self.sys.content_editable.as_deref()
387        }
388        /// Set the value of the `contenteditable` attribute
389        pub fn set_content_editable(
390            &mut self,
391            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
392        ) {
393            self.sys.content_editable = value.map(|v| v.into());
394        }
395        /// Get the value of the `dir` attribute
396        pub fn direction(&self) -> std::option::Option<&str> {
397            self.sys.direction.as_deref()
398        }
399        /// Set the value of the `dir` attribute
400        pub fn set_direction(
401            &mut self,
402            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
403        ) {
404            self.sys.direction = value.map(|v| v.into());
405        }
406        /// Get the value of the `draggable` attribute
407        pub fn draggable(&self) -> bool {
408            self.sys.draggable
409        }
410        /// Set the value of the `draggable` attribute
411        pub fn set_draggable(&mut self, value: bool) {
412            self.sys.draggable = value;
413        }
414        /// Get the value of the `enterkeyhint` attribute
415        pub fn enter_key_hint(&self) -> std::option::Option<&str> {
416            self.sys.enter_key_hint.as_deref()
417        }
418        /// Set the value of the `enterkeyhint` attribute
419        pub fn set_enter_key_hint(
420            &mut self,
421            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
422        ) {
423            self.sys.enter_key_hint = value.map(|v| v.into());
424        }
425        /// Get the value of the `exportparts` attribute
426        pub fn export_parts(&self) -> std::option::Option<&str> {
427            self.sys.export_parts.as_deref()
428        }
429        /// Set the value of the `exportparts` attribute
430        pub fn set_export_parts(
431            &mut self,
432            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
433        ) {
434            self.sys.export_parts = value.map(|v| v.into());
435        }
436        /// Get the value of the `hidden` attribute
437        pub fn hidden(&self) -> std::option::Option<&str> {
438            self.sys.hidden.as_deref()
439        }
440        /// Set the value of the `hidden` attribute
441        pub fn set_hidden(
442            &mut self,
443            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
444        ) {
445            self.sys.hidden = value.map(|v| v.into());
446        }
447        /// Get the value of the `id` attribute
448        pub fn id(&self) -> std::option::Option<&str> {
449            self.sys.id.as_deref()
450        }
451        /// Set the value of the `id` attribute
452        pub fn set_id(
453            &mut self,
454            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
455        ) {
456            self.sys.id = value.map(|v| v.into());
457        }
458        /// Get the value of the `inert` attribute
459        pub fn inert(&self) -> bool {
460            self.sys.inert
461        }
462        /// Set the value of the `inert` attribute
463        pub fn set_inert(&mut self, value: bool) {
464            self.sys.inert = value;
465        }
466        /// Get the value of the `inputmode` attribute
467        pub fn input_mode(&self) -> std::option::Option<&str> {
468            self.sys.input_mode.as_deref()
469        }
470        /// Set the value of the `inputmode` attribute
471        pub fn set_input_mode(
472            &mut self,
473            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
474        ) {
475            self.sys.input_mode = value.map(|v| v.into());
476        }
477        /// Get the value of the `is` attribute
478        pub fn is_(&self) -> std::option::Option<&str> {
479            self.sys.is_.as_deref()
480        }
481        /// Set the value of the `is` attribute
482        pub fn set_is_(
483            &mut self,
484            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
485        ) {
486            self.sys.is_ = value.map(|v| v.into());
487        }
488        /// Get the value of the `itemid` attribute
489        pub fn item_id(&self) -> std::option::Option<&str> {
490            self.sys.item_id.as_deref()
491        }
492        /// Set the value of the `itemid` attribute
493        pub fn set_item_id(
494            &mut self,
495            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
496        ) {
497            self.sys.item_id = value.map(|v| v.into());
498        }
499        /// Get the value of the `itemprop` attribute
500        pub fn item_prop(&self) -> std::option::Option<&str> {
501            self.sys.item_prop.as_deref()
502        }
503        /// Set the value of the `itemprop` attribute
504        pub fn set_item_prop(
505            &mut self,
506            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
507        ) {
508            self.sys.item_prop = value.map(|v| v.into());
509        }
510        /// Get the value of the `itemref` attribute
511        pub fn item_ref(&self) -> std::option::Option<&str> {
512            self.sys.item_ref.as_deref()
513        }
514        /// Set the value of the `itemref` attribute
515        pub fn set_item_ref(
516            &mut self,
517            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
518        ) {
519            self.sys.item_ref = value.map(|v| v.into());
520        }
521        /// Get the value of the `itemscope` attribute
522        pub fn item_scope(&self) -> std::option::Option<&str> {
523            self.sys.item_scope.as_deref()
524        }
525        /// Set the value of the `itemscope` attribute
526        pub fn set_item_scope(
527            &mut self,
528            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
529        ) {
530            self.sys.item_scope = value.map(|v| v.into());
531        }
532        /// Get the value of the `itemtype` attribute
533        pub fn item_type(&self) -> std::option::Option<&str> {
534            self.sys.item_type.as_deref()
535        }
536        /// Set the value of the `itemtype` attribute
537        pub fn set_item_type(
538            &mut self,
539            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
540        ) {
541            self.sys.item_type = value.map(|v| v.into());
542        }
543        /// Get the value of the `lang` attribute
544        pub fn lang(&self) -> std::option::Option<&str> {
545            self.sys.lang.as_deref()
546        }
547        /// Set the value of the `lang` attribute
548        pub fn set_lang(
549            &mut self,
550            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
551        ) {
552            self.sys.lang = value.map(|v| v.into());
553        }
554        /// Get the value of the `nonce` attribute
555        pub fn nonce(&self) -> std::option::Option<&str> {
556            self.sys.nonce.as_deref()
557        }
558        /// Set the value of the `nonce` attribute
559        pub fn set_nonce(
560            &mut self,
561            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
562        ) {
563            self.sys.nonce = value.map(|v| v.into());
564        }
565        /// Get the value of the `part` attribute
566        pub fn part(&self) -> std::option::Option<&str> {
567            self.sys.part.as_deref()
568        }
569        /// Set the value of the `part` attribute
570        pub fn set_part(
571            &mut self,
572            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
573        ) {
574            self.sys.part = value.map(|v| v.into());
575        }
576        /// Get the value of the `slot` attribute
577        pub fn slot(&self) -> std::option::Option<&str> {
578            self.sys.slot.as_deref()
579        }
580        /// Set the value of the `slot` attribute
581        pub fn set_slot(
582            &mut self,
583            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
584        ) {
585            self.sys.slot = value.map(|v| v.into());
586        }
587        /// Get the value of the `spellcheck` attribute
588        pub fn spellcheck(&self) -> std::option::Option<&str> {
589            self.sys.spellcheck.as_deref()
590        }
591        /// Set the value of the `spellcheck` attribute
592        pub fn set_spellcheck(
593            &mut self,
594            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
595        ) {
596            self.sys.spellcheck = value.map(|v| v.into());
597        }
598        /// Get the value of the `style` attribute
599        pub fn style(&self) -> std::option::Option<&str> {
600            self.sys.style.as_deref()
601        }
602        /// Set the value of the `style` attribute
603        pub fn set_style(
604            &mut self,
605            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
606        ) {
607            self.sys.style = value.map(|v| v.into());
608        }
609        /// Get the value of the `tabindex` attribute
610        pub fn tab_index(&self) -> std::option::Option<i64> {
611            self.sys.tab_index
612        }
613        /// Set the value of the `tabindex` attribute
614        pub fn set_tab_index(&mut self, value: std::option::Option<i64>) {
615            self.sys.tab_index = value;
616        }
617        /// Get the value of the `title` attribute
618        pub fn title(&self) -> std::option::Option<&str> {
619            self.sys.title.as_deref()
620        }
621        /// Set the value of the `title` attribute
622        pub fn set_title(
623            &mut self,
624            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
625        ) {
626            self.sys.title = value.map(|v| v.into());
627        }
628        /// Get the value of the `translate` attribute
629        pub fn translate(&self) -> bool {
630            self.sys.translate
631        }
632        /// Set the value of the `translate` attribute
633        pub fn set_translate(&mut self, value: bool) {
634            self.sys.translate = value;
635        }
636    }
637    impl Menu {
638        /// Access the element's children
639        pub fn children(&self) -> &[super::child::MenuChild] {
640            self.children.as_ref()
641        }
642        /// Mutably access the element's children
643        pub fn children_mut(&mut self) -> &mut Vec<super::child::MenuChild> {
644            &mut self.children
645        }
646    }
647    impl crate::Render for Menu {
648        fn render(
649            &self,
650            f: &mut std::fmt::Formatter<'_>,
651            depth: usize,
652        ) -> std::fmt::Result {
653            write!(f, "{:level$}", "", level = depth * 4)?;
654            html_sys::RenderElement::write_opening_tag(&self.sys, f)?;
655            if !self.children.is_empty() {
656                write!(f, "\n")?;
657            }
658            for el in &self.children {
659                crate::Render::render(&el, f, depth)?;
660                write!(f, "\n")?;
661            }
662            write!(f, "{:level$}", "", level = depth * 4)?;
663            html_sys::RenderElement::write_closing_tag(&self.sys, f)?;
664            Ok(())
665        }
666    }
667    impl std::fmt::Debug for Menu {
668        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
669            crate::Render::render(self, f, 0)?;
670            Ok(())
671        }
672    }
673    impl std::fmt::Display for Menu {
674        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
675            html_sys::RenderElement::write_opening_tag(&self.sys, f)?;
676            for el in &self.children {
677                write!(f, "{el}")?;
678            }
679            html_sys::RenderElement::write_closing_tag(&self.sys, f)?;
680            Ok(())
681        }
682    }
683    impl crate::HtmlElement for Menu {}
684    impl crate::FlowContent for Menu {}
685    impl crate::PalpableContent for Menu {}
686    impl std::convert::Into<html_sys::text::Menu> for Menu {
687        fn into(self) -> html_sys::text::Menu {
688            self.sys
689        }
690    }
691    impl From<html_sys::text::Menu> for Menu {
692        fn from(sys: html_sys::text::Menu) -> Self {
693            Self { sys, children: vec![] }
694        }
695    }
696}
697pub mod child {
698    /// The permitted child items for the `Menu` element
699    #[derive(PartialEq, Clone)]
700    pub enum MenuChild {
701        /// The ListItem element
702        ListItem(crate::generated::all::ListItem),
703        /// The Script element
704        Script(crate::generated::all::Script),
705        /// The Template element
706        Template(crate::generated::all::Template),
707    }
708    impl std::convert::From<crate::generated::all::ListItem> for MenuChild {
709        fn from(value: crate::generated::all::ListItem) -> Self {
710            Self::ListItem(value)
711        }
712    }
713    impl std::convert::From<crate::generated::all::Script> for MenuChild {
714        fn from(value: crate::generated::all::Script) -> Self {
715            Self::Script(value)
716        }
717    }
718    impl std::convert::From<crate::generated::all::Template> for MenuChild {
719        fn from(value: crate::generated::all::Template) -> Self {
720            Self::Template(value)
721        }
722    }
723    impl crate::Render for MenuChild {
724        fn render(
725            &self,
726            f: &mut std::fmt::Formatter<'_>,
727            depth: usize,
728        ) -> std::fmt::Result {
729            match self {
730                Self::ListItem(el) => crate::Render::render(el, f, depth + 1),
731                Self::Script(el) => crate::Render::render(el, f, depth + 1),
732                Self::Template(el) => crate::Render::render(el, f, depth + 1),
733            }
734        }
735    }
736    impl std::fmt::Debug for MenuChild {
737        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
738            crate::Render::render(self, f, 0)?;
739            Ok(())
740        }
741    }
742    impl std::fmt::Display for MenuChild {
743        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
744            match self {
745                Self::ListItem(el) => write!(f, "{el}"),
746                Self::Script(el) => write!(f, "{el}"),
747                Self::Template(el) => write!(f, "{el}"),
748            }
749        }
750    }
751}
752pub mod builder {
753    /// A builder struct for Menu
754    pub struct MenuBuilder {
755        element: super::element::Menu,
756    }
757    impl MenuBuilder {
758        pub(crate) fn new(element: super::element::Menu) -> Self {
759            Self { element }
760        }
761        /// Finish building the element
762        pub fn build(&mut self) -> super::element::Menu {
763            self.element.clone()
764        }
765        /// Insert a `data-*` property
766        pub fn data(
767            &mut self,
768            data_key: impl Into<std::borrow::Cow<'static, str>>,
769            value: impl Into<std::borrow::Cow<'static, str>>,
770        ) -> &mut MenuBuilder {
771            self.element.data_map_mut().insert(data_key.into(), value.into());
772            self
773        }
774        /// Append a new `ListItem` element
775        pub fn list_item<F>(&mut self, f: F) -> &mut Self
776        where
777            F: for<'a> FnOnce(
778                &'a mut crate::generated::all::builders::ListItemBuilder,
779            ) -> &'a mut crate::generated::all::builders::ListItemBuilder,
780        {
781            let ty: crate::generated::all::ListItem = Default::default();
782            let mut ty_builder = crate::generated::all::builders::ListItemBuilder::new(
783                ty,
784            );
785            (f)(&mut ty_builder);
786            let ty = ty_builder.build();
787            self.element.children_mut().push(ty.into());
788            self
789        }
790        /// Append a new `Script` element
791        pub fn script<F>(&mut self, f: F) -> &mut Self
792        where
793            F: for<'a> FnOnce(
794                &'a mut crate::generated::all::builders::ScriptBuilder,
795            ) -> &'a mut crate::generated::all::builders::ScriptBuilder,
796        {
797            let ty: crate::generated::all::Script = Default::default();
798            let mut ty_builder = crate::generated::all::builders::ScriptBuilder::new(ty);
799            (f)(&mut ty_builder);
800            let ty = ty_builder.build();
801            self.element.children_mut().push(ty.into());
802            self
803        }
804        /// Append a new `Template` element
805        pub fn template<F>(&mut self, f: F) -> &mut Self
806        where
807            F: for<'a> FnOnce(
808                &'a mut crate::generated::all::builders::TemplateBuilder,
809            ) -> &'a mut crate::generated::all::builders::TemplateBuilder,
810        {
811            let ty: crate::generated::all::Template = Default::default();
812            let mut ty_builder = crate::generated::all::builders::TemplateBuilder::new(
813                ty,
814            );
815            (f)(&mut ty_builder);
816            let ty = ty_builder.build();
817            self.element.children_mut().push(ty.into());
818            self
819        }
820        /// Set the value of the `role` attribute
821        pub fn role(
822            &mut self,
823            value: impl Into<std::borrow::Cow<'static, str>>,
824        ) -> &mut Self {
825            self.element.set_role(Some(value.into()));
826            self
827        }
828        /// Set the value of the `aria-activedescendant` attribute
829        pub fn aria_active_descendant_element(
830            &mut self,
831            value: impl Into<std::borrow::Cow<'static, str>>,
832        ) -> &mut Self {
833            self.element.set_aria_active_descendant_element(Some(value.into()));
834            self
835        }
836        /// Set the value of the `aria-atomic` attribute
837        pub fn aria_atomic(&mut self, value: bool) -> &mut Self {
838            self.element.set_aria_atomic(value);
839            self
840        }
841        /// Set the value of the `aria-braillelabel` attribute
842        pub fn aria_braille_label(
843            &mut self,
844            value: impl Into<std::borrow::Cow<'static, str>>,
845        ) -> &mut Self {
846            self.element.set_aria_braille_label(Some(value.into()));
847            self
848        }
849        /// Set the value of the `aria-brailleroledescription` attribute
850        pub fn aria_braille_role_description(
851            &mut self,
852            value: impl Into<std::borrow::Cow<'static, str>>,
853        ) -> &mut Self {
854            self.element.set_aria_braille_role_description(Some(value.into()));
855            self
856        }
857        /// Set the value of the `aria-busy` attribute
858        pub fn aria_busy(&mut self, value: bool) -> &mut Self {
859            self.element.set_aria_busy(value);
860            self
861        }
862        /// Set the value of the `aria-controls` attribute
863        pub fn aria_controls_elements(
864            &mut self,
865            value: impl Into<std::borrow::Cow<'static, str>>,
866        ) -> &mut Self {
867            self.element.set_aria_controls_elements(Some(value.into()));
868            self
869        }
870        /// Set the value of the `aria-current` attribute
871        pub fn aria_current(
872            &mut self,
873            value: impl Into<std::borrow::Cow<'static, str>>,
874        ) -> &mut Self {
875            self.element.set_aria_current(Some(value.into()));
876            self
877        }
878        /// Set the value of the `aria-describedby` attribute
879        pub fn aria_described_by_elements(
880            &mut self,
881            value: impl Into<std::borrow::Cow<'static, str>>,
882        ) -> &mut Self {
883            self.element.set_aria_described_by_elements(Some(value.into()));
884            self
885        }
886        /// Set the value of the `aria-description` attribute
887        pub fn aria_description(
888            &mut self,
889            value: impl Into<std::borrow::Cow<'static, str>>,
890        ) -> &mut Self {
891            self.element.set_aria_description(Some(value.into()));
892            self
893        }
894        /// Set the value of the `aria-details` attribute
895        pub fn aria_details_elements(
896            &mut self,
897            value: impl Into<std::borrow::Cow<'static, str>>,
898        ) -> &mut Self {
899            self.element.set_aria_details_elements(Some(value.into()));
900            self
901        }
902        /// Set the value of the `aria-disabled` attribute
903        pub fn aria_disabled(&mut self, value: bool) -> &mut Self {
904            self.element.set_aria_disabled(value);
905            self
906        }
907        /// Set the value of the `aria-dropeffect` attribute
908        pub fn aria_drop_effect(
909            &mut self,
910            value: impl Into<std::borrow::Cow<'static, str>>,
911        ) -> &mut Self {
912            self.element.set_aria_drop_effect(Some(value.into()));
913            self
914        }
915        /// Set the value of the `aria-errormessage` attribute
916        pub fn aria_error_message_elements(
917            &mut self,
918            value: impl Into<std::borrow::Cow<'static, str>>,
919        ) -> &mut Self {
920            self.element.set_aria_error_message_elements(Some(value.into()));
921            self
922        }
923        /// Set the value of the `aria-expanded` attribute
924        pub fn aria_expanded(&mut self, value: bool) -> &mut Self {
925            self.element.set_aria_expanded(value);
926            self
927        }
928        /// Set the value of the `aria-flowto` attribute
929        pub fn aria_flow_to_elements(
930            &mut self,
931            value: impl Into<std::borrow::Cow<'static, str>>,
932        ) -> &mut Self {
933            self.element.set_aria_flow_to_elements(Some(value.into()));
934            self
935        }
936        /// Set the value of the `aria-grabbed` attribute
937        pub fn aria_grabbed(&mut self, value: bool) -> &mut Self {
938            self.element.set_aria_grabbed(value);
939            self
940        }
941        /// Set the value of the `aria-haspopup` attribute
942        pub fn aria_has_popup(
943            &mut self,
944            value: impl Into<std::borrow::Cow<'static, str>>,
945        ) -> &mut Self {
946            self.element.set_aria_has_popup(Some(value.into()));
947            self
948        }
949        /// Set the value of the `aria-hidden` attribute
950        pub fn aria_hidden(&mut self, value: bool) -> &mut Self {
951            self.element.set_aria_hidden(value);
952            self
953        }
954        /// Set the value of the `aria-invalid` attribute
955        pub fn aria_invalid(
956            &mut self,
957            value: impl Into<std::borrow::Cow<'static, str>>,
958        ) -> &mut Self {
959            self.element.set_aria_invalid(Some(value.into()));
960            self
961        }
962        /// Set the value of the `aria-keyshortcuts` attribute
963        pub fn aria_key_shortcuts(
964            &mut self,
965            value: impl Into<std::borrow::Cow<'static, str>>,
966        ) -> &mut Self {
967            self.element.set_aria_key_shortcuts(Some(value.into()));
968            self
969        }
970        /// Set the value of the `aria-label` attribute
971        pub fn aria_label(
972            &mut self,
973            value: impl Into<std::borrow::Cow<'static, str>>,
974        ) -> &mut Self {
975            self.element.set_aria_label(Some(value.into()));
976            self
977        }
978        /// Set the value of the `aria-labelledby` attribute
979        pub fn aria_labelled_by_elements(
980            &mut self,
981            value: impl Into<std::borrow::Cow<'static, str>>,
982        ) -> &mut Self {
983            self.element.set_aria_labelled_by_elements(Some(value.into()));
984            self
985        }
986        /// Set the value of the `aria-live` attribute
987        pub fn aria_live(
988            &mut self,
989            value: impl Into<std::borrow::Cow<'static, str>>,
990        ) -> &mut Self {
991            self.element.set_aria_live(Some(value.into()));
992            self
993        }
994        /// Set the value of the `aria-multiselectable` attribute
995        pub fn aria_multi_selectable(&mut self, value: bool) -> &mut Self {
996            self.element.set_aria_multi_selectable(value);
997            self
998        }
999        /// Set the value of the `aria-orientation` attribute
1000        pub fn aria_orientation(
1001            &mut self,
1002            value: impl Into<std::borrow::Cow<'static, str>>,
1003        ) -> &mut Self {
1004            self.element.set_aria_orientation(Some(value.into()));
1005            self
1006        }
1007        /// Set the value of the `aria-owns` attribute
1008        pub fn aria_owns_elements(
1009            &mut self,
1010            value: impl Into<std::borrow::Cow<'static, str>>,
1011        ) -> &mut Self {
1012            self.element.set_aria_owns_elements(Some(value.into()));
1013            self
1014        }
1015        /// Set the value of the `aria-readonly` attribute
1016        pub fn aria_read_only(&mut self, value: bool) -> &mut Self {
1017            self.element.set_aria_read_only(value);
1018            self
1019        }
1020        /// Set the value of the `aria-relevant` attribute
1021        pub fn aria_relevant(
1022            &mut self,
1023            value: impl Into<std::borrow::Cow<'static, str>>,
1024        ) -> &mut Self {
1025            self.element.set_aria_relevant(Some(value.into()));
1026            self
1027        }
1028        /// Set the value of the `aria-required` attribute
1029        pub fn aria_required(&mut self, value: bool) -> &mut Self {
1030            self.element.set_aria_required(value);
1031            self
1032        }
1033        /// Set the value of the `aria-roledescription` attribute
1034        pub fn aria_role_description(
1035            &mut self,
1036            value: impl Into<std::borrow::Cow<'static, str>>,
1037        ) -> &mut Self {
1038            self.element.set_aria_role_description(Some(value.into()));
1039            self
1040        }
1041        /// Set the value of the `accesskey` attribute
1042        pub fn access_key(
1043            &mut self,
1044            value: impl Into<std::borrow::Cow<'static, str>>,
1045        ) -> &mut Self {
1046            self.element.set_access_key(Some(value.into()));
1047            self
1048        }
1049        /// Set the value of the `autocapitalize` attribute
1050        pub fn auto_capitalize(
1051            &mut self,
1052            value: impl Into<std::borrow::Cow<'static, str>>,
1053        ) -> &mut Self {
1054            self.element.set_auto_capitalize(Some(value.into()));
1055            self
1056        }
1057        /// Set the value of the `autofocus` attribute
1058        pub fn autofocus(&mut self, value: bool) -> &mut Self {
1059            self.element.set_autofocus(value);
1060            self
1061        }
1062        /// Set the value of the `class` attribute
1063        pub fn class(
1064            &mut self,
1065            value: impl Into<std::borrow::Cow<'static, str>>,
1066        ) -> &mut Self {
1067            self.element.set_class(Some(value.into()));
1068            self
1069        }
1070        /// Set the value of the `contenteditable` attribute
1071        pub fn content_editable(
1072            &mut self,
1073            value: impl Into<std::borrow::Cow<'static, str>>,
1074        ) -> &mut Self {
1075            self.element.set_content_editable(Some(value.into()));
1076            self
1077        }
1078        /// Set the value of the `dir` attribute
1079        pub fn direction(
1080            &mut self,
1081            value: impl Into<std::borrow::Cow<'static, str>>,
1082        ) -> &mut Self {
1083            self.element.set_direction(Some(value.into()));
1084            self
1085        }
1086        /// Set the value of the `draggable` attribute
1087        pub fn draggable(&mut self, value: bool) -> &mut Self {
1088            self.element.set_draggable(value);
1089            self
1090        }
1091        /// Set the value of the `enterkeyhint` attribute
1092        pub fn enter_key_hint(
1093            &mut self,
1094            value: impl Into<std::borrow::Cow<'static, str>>,
1095        ) -> &mut Self {
1096            self.element.set_enter_key_hint(Some(value.into()));
1097            self
1098        }
1099        /// Set the value of the `exportparts` attribute
1100        pub fn export_parts(
1101            &mut self,
1102            value: impl Into<std::borrow::Cow<'static, str>>,
1103        ) -> &mut Self {
1104            self.element.set_export_parts(Some(value.into()));
1105            self
1106        }
1107        /// Set the value of the `hidden` attribute
1108        pub fn hidden(
1109            &mut self,
1110            value: impl Into<std::borrow::Cow<'static, str>>,
1111        ) -> &mut Self {
1112            self.element.set_hidden(Some(value.into()));
1113            self
1114        }
1115        /// Set the value of the `id` attribute
1116        pub fn id(
1117            &mut self,
1118            value: impl Into<std::borrow::Cow<'static, str>>,
1119        ) -> &mut Self {
1120            self.element.set_id(Some(value.into()));
1121            self
1122        }
1123        /// Set the value of the `inert` attribute
1124        pub fn inert(&mut self, value: bool) -> &mut Self {
1125            self.element.set_inert(value);
1126            self
1127        }
1128        /// Set the value of the `inputmode` attribute
1129        pub fn input_mode(
1130            &mut self,
1131            value: impl Into<std::borrow::Cow<'static, str>>,
1132        ) -> &mut Self {
1133            self.element.set_input_mode(Some(value.into()));
1134            self
1135        }
1136        /// Set the value of the `is` attribute
1137        pub fn is_(
1138            &mut self,
1139            value: impl Into<std::borrow::Cow<'static, str>>,
1140        ) -> &mut Self {
1141            self.element.set_is_(Some(value.into()));
1142            self
1143        }
1144        /// Set the value of the `itemid` attribute
1145        pub fn item_id(
1146            &mut self,
1147            value: impl Into<std::borrow::Cow<'static, str>>,
1148        ) -> &mut Self {
1149            self.element.set_item_id(Some(value.into()));
1150            self
1151        }
1152        /// Set the value of the `itemprop` attribute
1153        pub fn item_prop(
1154            &mut self,
1155            value: impl Into<std::borrow::Cow<'static, str>>,
1156        ) -> &mut Self {
1157            self.element.set_item_prop(Some(value.into()));
1158            self
1159        }
1160        /// Set the value of the `itemref` attribute
1161        pub fn item_ref(
1162            &mut self,
1163            value: impl Into<std::borrow::Cow<'static, str>>,
1164        ) -> &mut Self {
1165            self.element.set_item_ref(Some(value.into()));
1166            self
1167        }
1168        /// Set the value of the `itemscope` attribute
1169        pub fn item_scope(
1170            &mut self,
1171            value: impl Into<std::borrow::Cow<'static, str>>,
1172        ) -> &mut Self {
1173            self.element.set_item_scope(Some(value.into()));
1174            self
1175        }
1176        /// Set the value of the `itemtype` attribute
1177        pub fn item_type(
1178            &mut self,
1179            value: impl Into<std::borrow::Cow<'static, str>>,
1180        ) -> &mut Self {
1181            self.element.set_item_type(Some(value.into()));
1182            self
1183        }
1184        /// Set the value of the `lang` attribute
1185        pub fn lang(
1186            &mut self,
1187            value: impl Into<std::borrow::Cow<'static, str>>,
1188        ) -> &mut Self {
1189            self.element.set_lang(Some(value.into()));
1190            self
1191        }
1192        /// Set the value of the `nonce` attribute
1193        pub fn nonce(
1194            &mut self,
1195            value: impl Into<std::borrow::Cow<'static, str>>,
1196        ) -> &mut Self {
1197            self.element.set_nonce(Some(value.into()));
1198            self
1199        }
1200        /// Set the value of the `part` attribute
1201        pub fn part(
1202            &mut self,
1203            value: impl Into<std::borrow::Cow<'static, str>>,
1204        ) -> &mut Self {
1205            self.element.set_part(Some(value.into()));
1206            self
1207        }
1208        /// Set the value of the `slot` attribute
1209        pub fn slot(
1210            &mut self,
1211            value: impl Into<std::borrow::Cow<'static, str>>,
1212        ) -> &mut Self {
1213            self.element.set_slot(Some(value.into()));
1214            self
1215        }
1216        /// Set the value of the `spellcheck` attribute
1217        pub fn spellcheck(
1218            &mut self,
1219            value: impl Into<std::borrow::Cow<'static, str>>,
1220        ) -> &mut Self {
1221            self.element.set_spellcheck(Some(value.into()));
1222            self
1223        }
1224        /// Set the value of the `style` attribute
1225        pub fn style(
1226            &mut self,
1227            value: impl Into<std::borrow::Cow<'static, str>>,
1228        ) -> &mut Self {
1229            self.element.set_style(Some(value.into()));
1230            self
1231        }
1232        /// Set the value of the `tabindex` attribute
1233        pub fn tab_index(&mut self, value: i64) -> &mut Self {
1234            self.element.set_tab_index(Some(value));
1235            self
1236        }
1237        /// Set the value of the `title` attribute
1238        pub fn title(
1239            &mut self,
1240            value: impl Into<std::borrow::Cow<'static, str>>,
1241        ) -> &mut Self {
1242            self.element.set_title(Some(value.into()));
1243            self
1244        }
1245        /// Set the value of the `translate` attribute
1246        pub fn translate(&mut self, value: bool) -> &mut Self {
1247            self.element.set_translate(value);
1248            self
1249        }
1250        /// Push a new child element to the list of children.
1251        pub fn push<T>(&mut self, child_el: T) -> &mut Self
1252        where
1253            T: Into<crate::generated::all::children::MenuChild>,
1254        {
1255            let child_el = child_el.into();
1256            self.element.children_mut().push(child_el);
1257            self
1258        }
1259        /// Extend the list of children with an iterator of child elements.
1260        pub fn extend<I, T>(&mut self, iter: I) -> &mut Self
1261        where
1262            I: IntoIterator<Item = T>,
1263            T: Into<crate::generated::all::children::MenuChild>,
1264        {
1265            let iter = iter.into_iter().map(|child_el| child_el.into());
1266            self.element.children_mut().extend(iter);
1267            self
1268        }
1269    }
1270}