1pub mod element {
2 #[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 pub fn builder() -> super::builder::TextTrackBuilder {
14 super::builder::TextTrackBuilder::new(Default::default())
15 }
16 }
17 impl TextTrack {
18 pub fn data_map(&self) -> &html_sys::DataMap {
20 &self.sys.data_map
21 }
22 pub fn data_map_mut(&mut self) -> &mut html_sys::DataMap {
24 &mut self.sys.data_map
25 }
26 }
27 impl TextTrack {
28 pub fn kind(&self) -> std::option::Option<&str> {
30 self.sys.kind.as_deref()
31 }
32 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 pub fn src(&self) -> std::option::Option<&str> {
41 self.sys.src.as_deref()
42 }
43 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 pub fn srclang(&self) -> std::option::Option<&str> {
52 self.sys.srclang.as_deref()
53 }
54 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 pub fn label(&self) -> std::option::Option<&str> {
63 self.sys.label.as_deref()
64 }
65 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 pub fn default(&self) -> bool {
74 self.sys.default
75 }
76 pub fn set_default(&mut self, value: bool) {
78 self.sys.default = value;
79 }
80 pub fn access_key(&self) -> std::option::Option<&str> {
82 self.sys.access_key.as_deref()
83 }
84 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 pub fn auto_capitalize(&self) -> std::option::Option<&str> {
93 self.sys.auto_capitalize.as_deref()
94 }
95 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 pub fn autofocus(&self) -> bool {
104 self.sys.autofocus
105 }
106 pub fn set_autofocus(&mut self, value: bool) {
108 self.sys.autofocus = value;
109 }
110 pub fn class(&self) -> std::option::Option<&str> {
112 self.sys.class.as_deref()
113 }
114 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 pub fn content_editable(&self) -> std::option::Option<&str> {
123 self.sys.content_editable.as_deref()
124 }
125 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 pub fn direction(&self) -> std::option::Option<&str> {
134 self.sys.direction.as_deref()
135 }
136 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 pub fn draggable(&self) -> bool {
145 self.sys.draggable
146 }
147 pub fn set_draggable(&mut self, value: bool) {
149 self.sys.draggable = value;
150 }
151 pub fn enter_key_hint(&self) -> std::option::Option<&str> {
153 self.sys.enter_key_hint.as_deref()
154 }
155 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 pub fn export_parts(&self) -> std::option::Option<&str> {
164 self.sys.export_parts.as_deref()
165 }
166 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 pub fn hidden(&self) -> std::option::Option<&str> {
175 self.sys.hidden.as_deref()
176 }
177 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 pub fn id(&self) -> std::option::Option<&str> {
186 self.sys.id.as_deref()
187 }
188 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 pub fn inert(&self) -> bool {
197 self.sys.inert
198 }
199 pub fn set_inert(&mut self, value: bool) {
201 self.sys.inert = value;
202 }
203 pub fn input_mode(&self) -> std::option::Option<&str> {
205 self.sys.input_mode.as_deref()
206 }
207 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 pub fn is_(&self) -> std::option::Option<&str> {
216 self.sys.is_.as_deref()
217 }
218 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 pub fn item_id(&self) -> std::option::Option<&str> {
227 self.sys.item_id.as_deref()
228 }
229 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 pub fn item_prop(&self) -> std::option::Option<&str> {
238 self.sys.item_prop.as_deref()
239 }
240 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 pub fn item_ref(&self) -> std::option::Option<&str> {
249 self.sys.item_ref.as_deref()
250 }
251 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 pub fn item_scope(&self) -> std::option::Option<&str> {
260 self.sys.item_scope.as_deref()
261 }
262 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 pub fn item_type(&self) -> std::option::Option<&str> {
271 self.sys.item_type.as_deref()
272 }
273 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 pub fn lang(&self) -> std::option::Option<&str> {
282 self.sys.lang.as_deref()
283 }
284 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 pub fn nonce(&self) -> std::option::Option<&str> {
293 self.sys.nonce.as_deref()
294 }
295 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 pub fn part(&self) -> std::option::Option<&str> {
304 self.sys.part.as_deref()
305 }
306 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 pub fn slot(&self) -> std::option::Option<&str> {
315 self.sys.slot.as_deref()
316 }
317 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 pub fn spellcheck(&self) -> std::option::Option<&str> {
326 self.sys.spellcheck.as_deref()
327 }
328 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 pub fn style(&self) -> std::option::Option<&str> {
337 self.sys.style.as_deref()
338 }
339 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 pub fn tab_index(&self) -> std::option::Option<i64> {
348 self.sys.tab_index
349 }
350 pub fn set_tab_index(&mut self, value: std::option::Option<i64>) {
352 self.sys.tab_index = value;
353 }
354 pub fn title(&self) -> std::option::Option<&str> {
356 self.sys.title.as_deref()
357 }
358 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 pub fn translate(&self) -> bool {
367 self.sys.translate
368 }
369 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 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 pub fn build(&mut self) -> super::element::TextTrack {
422 self.element.clone()
423 }
424 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 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 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 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 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 pub fn default(&mut self, value: bool) -> &mut Self {
467 self.element.set_default(value);
468 self
469 }
470 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 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 pub fn autofocus(&mut self, value: bool) -> &mut Self {
488 self.element.set_autofocus(value);
489 self
490 }
491 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 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 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 pub fn draggable(&mut self, value: bool) -> &mut Self {
517 self.element.set_draggable(value);
518 self
519 }
520 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 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 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 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 pub fn inert(&mut self, value: bool) -> &mut Self {
554 self.element.set_inert(value);
555 self
556 }
557 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 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 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 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 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 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 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 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 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 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 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 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 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 pub fn tab_index(&mut self, value: i64) -> &mut Self {
663 self.element.set_tab_index(Some(value));
664 self
665 }
666 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 pub fn translate(&mut self, value: bool) -> &mut Self {
676 self.element.set_translate(value);
677 self
678 }
679 }
680}