html/generated/
meta.rs

1pub mod element {
2    /// The HTML `<meta>` element
3    ///
4    /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta)
5    #[doc(alias = "meta")]
6    #[non_exhaustive]
7    #[derive(PartialEq, Clone, Default)]
8    pub struct Meta {
9        sys: html_sys::metadata::Meta,
10    }
11    impl Meta {
12        /// Create a new builder
13        pub fn builder() -> super::builder::MetaBuilder {
14            super::builder::MetaBuilder::new(Default::default())
15        }
16    }
17    impl Meta {
18        /// Access the element's `data-*` properties
19        pub fn data_map(&self) -> &html_sys::DataMap {
20            &self.sys.data_map
21        }
22        /// Mutably access the element's `data-*` properties
23        pub fn data_map_mut(&mut self) -> &mut html_sys::DataMap {
24            &mut self.sys.data_map
25        }
26    }
27    impl Meta {
28        /// Get the value of the `name` attribute
29        pub fn name(&self) -> std::option::Option<&str> {
30            self.sys.name.as_deref()
31        }
32        /// Set the value of the `name` attribute
33        pub fn set_name(
34            &mut self,
35            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
36        ) {
37            self.sys.name = value.map(|v| v.into());
38        }
39        /// Get the value of the `http-equiv` attribute
40        pub fn http_equiv(&self) -> std::option::Option<&str> {
41            self.sys.http_equiv.as_deref()
42        }
43        /// Set the value of the `http-equiv` attribute
44        pub fn set_http_equiv(
45            &mut self,
46            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
47        ) {
48            self.sys.http_equiv = value.map(|v| v.into());
49        }
50        /// Get the value of the `content` attribute
51        pub fn content(&self) -> std::option::Option<&str> {
52            self.sys.content.as_deref()
53        }
54        /// Set the value of the `content` attribute
55        pub fn set_content(
56            &mut self,
57            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
58        ) {
59            self.sys.content = value.map(|v| v.into());
60        }
61        /// Get the value of the `charset` attribute
62        pub fn charset(&self) -> std::option::Option<&str> {
63            self.sys.charset.as_deref()
64        }
65        /// Set the value of the `charset` attribute
66        pub fn set_charset(
67            &mut self,
68            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
69        ) {
70            self.sys.charset = value.map(|v| v.into());
71        }
72        /// Get the value of the `media` attribute
73        pub fn media(&self) -> std::option::Option<&str> {
74            self.sys.media.as_deref()
75        }
76        /// Set the value of the `media` attribute
77        pub fn set_media(
78            &mut self,
79            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
80        ) {
81            self.sys.media = value.map(|v| v.into());
82        }
83        /// Get the value of the `accesskey` attribute
84        pub fn access_key(&self) -> std::option::Option<&str> {
85            self.sys.access_key.as_deref()
86        }
87        /// Set the value of the `accesskey` attribute
88        pub fn set_access_key(
89            &mut self,
90            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
91        ) {
92            self.sys.access_key = value.map(|v| v.into());
93        }
94        /// Get the value of the `autocapitalize` attribute
95        pub fn auto_capitalize(&self) -> std::option::Option<&str> {
96            self.sys.auto_capitalize.as_deref()
97        }
98        /// Set the value of the `autocapitalize` attribute
99        pub fn set_auto_capitalize(
100            &mut self,
101            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
102        ) {
103            self.sys.auto_capitalize = value.map(|v| v.into());
104        }
105        /// Get the value of the `autofocus` attribute
106        pub fn autofocus(&self) -> bool {
107            self.sys.autofocus
108        }
109        /// Set the value of the `autofocus` attribute
110        pub fn set_autofocus(&mut self, value: bool) {
111            self.sys.autofocus = value;
112        }
113        /// Get the value of the `class` attribute
114        pub fn class(&self) -> std::option::Option<&str> {
115            self.sys.class.as_deref()
116        }
117        /// Set the value of the `class` attribute
118        pub fn set_class(
119            &mut self,
120            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
121        ) {
122            self.sys.class = value.map(|v| v.into());
123        }
124        /// Get the value of the `contenteditable` attribute
125        pub fn content_editable(&self) -> std::option::Option<&str> {
126            self.sys.content_editable.as_deref()
127        }
128        /// Set the value of the `contenteditable` attribute
129        pub fn set_content_editable(
130            &mut self,
131            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
132        ) {
133            self.sys.content_editable = value.map(|v| v.into());
134        }
135        /// Get the value of the `dir` attribute
136        pub fn direction(&self) -> std::option::Option<&str> {
137            self.sys.direction.as_deref()
138        }
139        /// Set the value of the `dir` attribute
140        pub fn set_direction(
141            &mut self,
142            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
143        ) {
144            self.sys.direction = value.map(|v| v.into());
145        }
146        /// Get the value of the `draggable` attribute
147        pub fn draggable(&self) -> bool {
148            self.sys.draggable
149        }
150        /// Set the value of the `draggable` attribute
151        pub fn set_draggable(&mut self, value: bool) {
152            self.sys.draggable = value;
153        }
154        /// Get the value of the `enterkeyhint` attribute
155        pub fn enter_key_hint(&self) -> std::option::Option<&str> {
156            self.sys.enter_key_hint.as_deref()
157        }
158        /// Set the value of the `enterkeyhint` attribute
159        pub fn set_enter_key_hint(
160            &mut self,
161            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
162        ) {
163            self.sys.enter_key_hint = value.map(|v| v.into());
164        }
165        /// Get the value of the `exportparts` attribute
166        pub fn export_parts(&self) -> std::option::Option<&str> {
167            self.sys.export_parts.as_deref()
168        }
169        /// Set the value of the `exportparts` attribute
170        pub fn set_export_parts(
171            &mut self,
172            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
173        ) {
174            self.sys.export_parts = value.map(|v| v.into());
175        }
176        /// Get the value of the `hidden` attribute
177        pub fn hidden(&self) -> std::option::Option<&str> {
178            self.sys.hidden.as_deref()
179        }
180        /// Set the value of the `hidden` attribute
181        pub fn set_hidden(
182            &mut self,
183            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
184        ) {
185            self.sys.hidden = value.map(|v| v.into());
186        }
187        /// Get the value of the `id` attribute
188        pub fn id(&self) -> std::option::Option<&str> {
189            self.sys.id.as_deref()
190        }
191        /// Set the value of the `id` attribute
192        pub fn set_id(
193            &mut self,
194            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
195        ) {
196            self.sys.id = value.map(|v| v.into());
197        }
198        /// Get the value of the `inert` attribute
199        pub fn inert(&self) -> bool {
200            self.sys.inert
201        }
202        /// Set the value of the `inert` attribute
203        pub fn set_inert(&mut self, value: bool) {
204            self.sys.inert = value;
205        }
206        /// Get the value of the `inputmode` attribute
207        pub fn input_mode(&self) -> std::option::Option<&str> {
208            self.sys.input_mode.as_deref()
209        }
210        /// Set the value of the `inputmode` attribute
211        pub fn set_input_mode(
212            &mut self,
213            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
214        ) {
215            self.sys.input_mode = value.map(|v| v.into());
216        }
217        /// Get the value of the `is` attribute
218        pub fn is_(&self) -> std::option::Option<&str> {
219            self.sys.is_.as_deref()
220        }
221        /// Set the value of the `is` attribute
222        pub fn set_is_(
223            &mut self,
224            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
225        ) {
226            self.sys.is_ = value.map(|v| v.into());
227        }
228        /// Get the value of the `itemid` attribute
229        pub fn item_id(&self) -> std::option::Option<&str> {
230            self.sys.item_id.as_deref()
231        }
232        /// Set the value of the `itemid` attribute
233        pub fn set_item_id(
234            &mut self,
235            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
236        ) {
237            self.sys.item_id = value.map(|v| v.into());
238        }
239        /// Get the value of the `itemprop` attribute
240        pub fn item_prop(&self) -> std::option::Option<&str> {
241            self.sys.item_prop.as_deref()
242        }
243        /// Set the value of the `itemprop` attribute
244        pub fn set_item_prop(
245            &mut self,
246            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
247        ) {
248            self.sys.item_prop = value.map(|v| v.into());
249        }
250        /// Get the value of the `itemref` attribute
251        pub fn item_ref(&self) -> std::option::Option<&str> {
252            self.sys.item_ref.as_deref()
253        }
254        /// Set the value of the `itemref` attribute
255        pub fn set_item_ref(
256            &mut self,
257            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
258        ) {
259            self.sys.item_ref = value.map(|v| v.into());
260        }
261        /// Get the value of the `itemscope` attribute
262        pub fn item_scope(&self) -> std::option::Option<&str> {
263            self.sys.item_scope.as_deref()
264        }
265        /// Set the value of the `itemscope` attribute
266        pub fn set_item_scope(
267            &mut self,
268            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
269        ) {
270            self.sys.item_scope = value.map(|v| v.into());
271        }
272        /// Get the value of the `itemtype` attribute
273        pub fn item_type(&self) -> std::option::Option<&str> {
274            self.sys.item_type.as_deref()
275        }
276        /// Set the value of the `itemtype` attribute
277        pub fn set_item_type(
278            &mut self,
279            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
280        ) {
281            self.sys.item_type = value.map(|v| v.into());
282        }
283        /// Get the value of the `lang` attribute
284        pub fn lang(&self) -> std::option::Option<&str> {
285            self.sys.lang.as_deref()
286        }
287        /// Set the value of the `lang` attribute
288        pub fn set_lang(
289            &mut self,
290            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
291        ) {
292            self.sys.lang = value.map(|v| v.into());
293        }
294        /// Get the value of the `nonce` attribute
295        pub fn nonce(&self) -> std::option::Option<&str> {
296            self.sys.nonce.as_deref()
297        }
298        /// Set the value of the `nonce` attribute
299        pub fn set_nonce(
300            &mut self,
301            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
302        ) {
303            self.sys.nonce = value.map(|v| v.into());
304        }
305        /// Get the value of the `part` attribute
306        pub fn part(&self) -> std::option::Option<&str> {
307            self.sys.part.as_deref()
308        }
309        /// Set the value of the `part` attribute
310        pub fn set_part(
311            &mut self,
312            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
313        ) {
314            self.sys.part = value.map(|v| v.into());
315        }
316        /// Get the value of the `slot` attribute
317        pub fn slot(&self) -> std::option::Option<&str> {
318            self.sys.slot.as_deref()
319        }
320        /// Set the value of the `slot` attribute
321        pub fn set_slot(
322            &mut self,
323            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
324        ) {
325            self.sys.slot = value.map(|v| v.into());
326        }
327        /// Get the value of the `spellcheck` attribute
328        pub fn spellcheck(&self) -> std::option::Option<&str> {
329            self.sys.spellcheck.as_deref()
330        }
331        /// Set the value of the `spellcheck` attribute
332        pub fn set_spellcheck(
333            &mut self,
334            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
335        ) {
336            self.sys.spellcheck = value.map(|v| v.into());
337        }
338        /// Get the value of the `style` attribute
339        pub fn style(&self) -> std::option::Option<&str> {
340            self.sys.style.as_deref()
341        }
342        /// Set the value of the `style` attribute
343        pub fn set_style(
344            &mut self,
345            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
346        ) {
347            self.sys.style = value.map(|v| v.into());
348        }
349        /// Get the value of the `tabindex` attribute
350        pub fn tab_index(&self) -> std::option::Option<i64> {
351            self.sys.tab_index
352        }
353        /// Set the value of the `tabindex` attribute
354        pub fn set_tab_index(&mut self, value: std::option::Option<i64>) {
355            self.sys.tab_index = value;
356        }
357        /// Get the value of the `title` attribute
358        pub fn title(&self) -> std::option::Option<&str> {
359            self.sys.title.as_deref()
360        }
361        /// Set the value of the `title` attribute
362        pub fn set_title(
363            &mut self,
364            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
365        ) {
366            self.sys.title = value.map(|v| v.into());
367        }
368        /// Get the value of the `translate` attribute
369        pub fn translate(&self) -> bool {
370            self.sys.translate
371        }
372        /// Set the value of the `translate` attribute
373        pub fn set_translate(&mut self, value: bool) {
374            self.sys.translate = value;
375        }
376    }
377    impl crate::Render for Meta {
378        fn render(
379            &self,
380            f: &mut std::fmt::Formatter<'_>,
381            depth: usize,
382        ) -> std::fmt::Result {
383            write!(f, "{:level$}", "", level = depth * 4)?;
384            html_sys::RenderElement::write_opening_tag(&self.sys, f)?;
385            Ok(())
386        }
387    }
388    impl std::fmt::Debug for Meta {
389        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
390            crate::Render::render(self, f, 0)?;
391            Ok(())
392        }
393    }
394    impl std::fmt::Display for Meta {
395        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
396            html_sys::RenderElement::write_opening_tag(&self.sys, f)?;
397            html_sys::RenderElement::write_closing_tag(&self.sys, f)?;
398            Ok(())
399        }
400    }
401    impl crate::HtmlElement for Meta {}
402    impl crate::MetadataContent for Meta {}
403    impl crate::FlowContent for Meta {}
404    impl crate::PhrasingContent for Meta {}
405    impl std::convert::Into<html_sys::metadata::Meta> for Meta {
406        fn into(self) -> html_sys::metadata::Meta {
407            self.sys
408        }
409    }
410    impl From<html_sys::metadata::Meta> for Meta {
411        fn from(sys: html_sys::metadata::Meta) -> Self {
412            Self { sys }
413        }
414    }
415}
416pub mod child {}
417pub mod builder {
418    /// A builder struct for Meta
419    pub struct MetaBuilder {
420        element: super::element::Meta,
421    }
422    impl MetaBuilder {
423        pub(crate) fn new(element: super::element::Meta) -> Self {
424            Self { element }
425        }
426        /// Finish building the element
427        pub fn build(&mut self) -> super::element::Meta {
428            self.element.clone()
429        }
430        /// Insert a `data-*` property
431        pub fn data(
432            &mut self,
433            data_key: impl Into<std::borrow::Cow<'static, str>>,
434            value: impl Into<std::borrow::Cow<'static, str>>,
435        ) -> &mut MetaBuilder {
436            self.element.data_map_mut().insert(data_key.into(), value.into());
437            self
438        }
439        /// Set the value of the `name` attribute
440        pub fn name(
441            &mut self,
442            value: impl Into<std::borrow::Cow<'static, str>>,
443        ) -> &mut Self {
444            self.element.set_name(Some(value.into()));
445            self
446        }
447        /// Set the value of the `http-equiv` attribute
448        pub fn http_equiv(
449            &mut self,
450            value: impl Into<std::borrow::Cow<'static, str>>,
451        ) -> &mut Self {
452            self.element.set_http_equiv(Some(value.into()));
453            self
454        }
455        /// Set the value of the `content` attribute
456        pub fn content(
457            &mut self,
458            value: impl Into<std::borrow::Cow<'static, str>>,
459        ) -> &mut Self {
460            self.element.set_content(Some(value.into()));
461            self
462        }
463        /// Set the value of the `charset` attribute
464        pub fn charset(
465            &mut self,
466            value: impl Into<std::borrow::Cow<'static, str>>,
467        ) -> &mut Self {
468            self.element.set_charset(Some(value.into()));
469            self
470        }
471        /// Set the value of the `media` attribute
472        pub fn media(
473            &mut self,
474            value: impl Into<std::borrow::Cow<'static, str>>,
475        ) -> &mut Self {
476            self.element.set_media(Some(value.into()));
477            self
478        }
479        /// Set the value of the `accesskey` attribute
480        pub fn access_key(
481            &mut self,
482            value: impl Into<std::borrow::Cow<'static, str>>,
483        ) -> &mut Self {
484            self.element.set_access_key(Some(value.into()));
485            self
486        }
487        /// Set the value of the `autocapitalize` attribute
488        pub fn auto_capitalize(
489            &mut self,
490            value: impl Into<std::borrow::Cow<'static, str>>,
491        ) -> &mut Self {
492            self.element.set_auto_capitalize(Some(value.into()));
493            self
494        }
495        /// Set the value of the `autofocus` attribute
496        pub fn autofocus(&mut self, value: bool) -> &mut Self {
497            self.element.set_autofocus(value);
498            self
499        }
500        /// Set the value of the `class` attribute
501        pub fn class(
502            &mut self,
503            value: impl Into<std::borrow::Cow<'static, str>>,
504        ) -> &mut Self {
505            self.element.set_class(Some(value.into()));
506            self
507        }
508        /// Set the value of the `contenteditable` attribute
509        pub fn content_editable(
510            &mut self,
511            value: impl Into<std::borrow::Cow<'static, str>>,
512        ) -> &mut Self {
513            self.element.set_content_editable(Some(value.into()));
514            self
515        }
516        /// Set the value of the `dir` attribute
517        pub fn direction(
518            &mut self,
519            value: impl Into<std::borrow::Cow<'static, str>>,
520        ) -> &mut Self {
521            self.element.set_direction(Some(value.into()));
522            self
523        }
524        /// Set the value of the `draggable` attribute
525        pub fn draggable(&mut self, value: bool) -> &mut Self {
526            self.element.set_draggable(value);
527            self
528        }
529        /// Set the value of the `enterkeyhint` attribute
530        pub fn enter_key_hint(
531            &mut self,
532            value: impl Into<std::borrow::Cow<'static, str>>,
533        ) -> &mut Self {
534            self.element.set_enter_key_hint(Some(value.into()));
535            self
536        }
537        /// Set the value of the `exportparts` attribute
538        pub fn export_parts(
539            &mut self,
540            value: impl Into<std::borrow::Cow<'static, str>>,
541        ) -> &mut Self {
542            self.element.set_export_parts(Some(value.into()));
543            self
544        }
545        /// Set the value of the `hidden` attribute
546        pub fn hidden(
547            &mut self,
548            value: impl Into<std::borrow::Cow<'static, str>>,
549        ) -> &mut Self {
550            self.element.set_hidden(Some(value.into()));
551            self
552        }
553        /// Set the value of the `id` attribute
554        pub fn id(
555            &mut self,
556            value: impl Into<std::borrow::Cow<'static, str>>,
557        ) -> &mut Self {
558            self.element.set_id(Some(value.into()));
559            self
560        }
561        /// Set the value of the `inert` attribute
562        pub fn inert(&mut self, value: bool) -> &mut Self {
563            self.element.set_inert(value);
564            self
565        }
566        /// Set the value of the `inputmode` attribute
567        pub fn input_mode(
568            &mut self,
569            value: impl Into<std::borrow::Cow<'static, str>>,
570        ) -> &mut Self {
571            self.element.set_input_mode(Some(value.into()));
572            self
573        }
574        /// Set the value of the `is` attribute
575        pub fn is_(
576            &mut self,
577            value: impl Into<std::borrow::Cow<'static, str>>,
578        ) -> &mut Self {
579            self.element.set_is_(Some(value.into()));
580            self
581        }
582        /// Set the value of the `itemid` attribute
583        pub fn item_id(
584            &mut self,
585            value: impl Into<std::borrow::Cow<'static, str>>,
586        ) -> &mut Self {
587            self.element.set_item_id(Some(value.into()));
588            self
589        }
590        /// Set the value of the `itemprop` attribute
591        pub fn item_prop(
592            &mut self,
593            value: impl Into<std::borrow::Cow<'static, str>>,
594        ) -> &mut Self {
595            self.element.set_item_prop(Some(value.into()));
596            self
597        }
598        /// Set the value of the `itemref` attribute
599        pub fn item_ref(
600            &mut self,
601            value: impl Into<std::borrow::Cow<'static, str>>,
602        ) -> &mut Self {
603            self.element.set_item_ref(Some(value.into()));
604            self
605        }
606        /// Set the value of the `itemscope` attribute
607        pub fn item_scope(
608            &mut self,
609            value: impl Into<std::borrow::Cow<'static, str>>,
610        ) -> &mut Self {
611            self.element.set_item_scope(Some(value.into()));
612            self
613        }
614        /// Set the value of the `itemtype` attribute
615        pub fn item_type(
616            &mut self,
617            value: impl Into<std::borrow::Cow<'static, str>>,
618        ) -> &mut Self {
619            self.element.set_item_type(Some(value.into()));
620            self
621        }
622        /// Set the value of the `lang` attribute
623        pub fn lang(
624            &mut self,
625            value: impl Into<std::borrow::Cow<'static, str>>,
626        ) -> &mut Self {
627            self.element.set_lang(Some(value.into()));
628            self
629        }
630        /// Set the value of the `nonce` attribute
631        pub fn nonce(
632            &mut self,
633            value: impl Into<std::borrow::Cow<'static, str>>,
634        ) -> &mut Self {
635            self.element.set_nonce(Some(value.into()));
636            self
637        }
638        /// Set the value of the `part` attribute
639        pub fn part(
640            &mut self,
641            value: impl Into<std::borrow::Cow<'static, str>>,
642        ) -> &mut Self {
643            self.element.set_part(Some(value.into()));
644            self
645        }
646        /// Set the value of the `slot` attribute
647        pub fn slot(
648            &mut self,
649            value: impl Into<std::borrow::Cow<'static, str>>,
650        ) -> &mut Self {
651            self.element.set_slot(Some(value.into()));
652            self
653        }
654        /// Set the value of the `spellcheck` attribute
655        pub fn spellcheck(
656            &mut self,
657            value: impl Into<std::borrow::Cow<'static, str>>,
658        ) -> &mut Self {
659            self.element.set_spellcheck(Some(value.into()));
660            self
661        }
662        /// Set the value of the `style` attribute
663        pub fn style(
664            &mut self,
665            value: impl Into<std::borrow::Cow<'static, str>>,
666        ) -> &mut Self {
667            self.element.set_style(Some(value.into()));
668            self
669        }
670        /// Set the value of the `tabindex` attribute
671        pub fn tab_index(&mut self, value: i64) -> &mut Self {
672            self.element.set_tab_index(Some(value));
673            self
674        }
675        /// Set the value of the `title` attribute
676        pub fn title(
677            &mut self,
678            value: impl Into<std::borrow::Cow<'static, str>>,
679        ) -> &mut Self {
680            self.element.set_title(Some(value.into()));
681            self
682        }
683        /// Set the value of the `translate` attribute
684        pub fn translate(&mut self, value: bool) -> &mut Self {
685            self.element.set_translate(value);
686            self
687        }
688    }
689}