html/generated/
track.rs

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