1pub mod element {
2 #[doc(alias = "source")]
6 #[non_exhaustive]
7 #[derive(PartialEq, Clone, Default)]
8 pub struct MediaSource {
9 sys: html_sys::embedded::MediaSource,
10 }
11 impl MediaSource {
12 pub fn builder() -> super::builder::MediaSourceBuilder {
14 super::builder::MediaSourceBuilder::new(Default::default())
15 }
16 }
17 impl MediaSource {
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 MediaSource {
28 pub fn type_(&self) -> std::option::Option<&str> {
30 self.sys.type_.as_deref()
31 }
32 pub fn set_type_(
34 &mut self,
35 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
36 ) {
37 self.sys.type_ = value.map(|v| v.into());
38 }
39 pub fn media(&self) -> std::option::Option<&str> {
41 self.sys.media.as_deref()
42 }
43 pub fn set_media(
45 &mut self,
46 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
47 ) {
48 self.sys.media = value.map(|v| v.into());
49 }
50 pub fn src(&self) -> std::option::Option<&str> {
52 self.sys.src.as_deref()
53 }
54 pub fn set_src(
56 &mut self,
57 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
58 ) {
59 self.sys.src = value.map(|v| v.into());
60 }
61 pub fn srcset(&self) -> std::option::Option<&str> {
63 self.sys.srcset.as_deref()
64 }
65 pub fn set_srcset(
67 &mut self,
68 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
69 ) {
70 self.sys.srcset = value.map(|v| v.into());
71 }
72 pub fn sizes(&self) -> std::option::Option<&str> {
74 self.sys.sizes.as_deref()
75 }
76 pub fn set_sizes(
78 &mut self,
79 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
80 ) {
81 self.sys.sizes = value.map(|v| v.into());
82 }
83 pub fn width(&self) -> std::option::Option<i64> {
85 self.sys.width
86 }
87 pub fn set_width(&mut self, value: std::option::Option<i64>) {
89 self.sys.width = value;
90 }
91 pub fn height(&self) -> std::option::Option<i64> {
93 self.sys.height
94 }
95 pub fn set_height(&mut self, value: std::option::Option<i64>) {
97 self.sys.height = value;
98 }
99 pub fn access_key(&self) -> std::option::Option<&str> {
101 self.sys.access_key.as_deref()
102 }
103 pub fn set_access_key(
105 &mut self,
106 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
107 ) {
108 self.sys.access_key = value.map(|v| v.into());
109 }
110 pub fn auto_capitalize(&self) -> std::option::Option<&str> {
112 self.sys.auto_capitalize.as_deref()
113 }
114 pub fn set_auto_capitalize(
116 &mut self,
117 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
118 ) {
119 self.sys.auto_capitalize = value.map(|v| v.into());
120 }
121 pub fn autofocus(&self) -> bool {
123 self.sys.autofocus
124 }
125 pub fn set_autofocus(&mut self, value: bool) {
127 self.sys.autofocus = value;
128 }
129 pub fn class(&self) -> std::option::Option<&str> {
131 self.sys.class.as_deref()
132 }
133 pub fn set_class(
135 &mut self,
136 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
137 ) {
138 self.sys.class = value.map(|v| v.into());
139 }
140 pub fn content_editable(&self) -> std::option::Option<&str> {
142 self.sys.content_editable.as_deref()
143 }
144 pub fn set_content_editable(
146 &mut self,
147 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
148 ) {
149 self.sys.content_editable = value.map(|v| v.into());
150 }
151 pub fn direction(&self) -> std::option::Option<&str> {
153 self.sys.direction.as_deref()
154 }
155 pub fn set_direction(
157 &mut self,
158 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
159 ) {
160 self.sys.direction = value.map(|v| v.into());
161 }
162 pub fn draggable(&self) -> bool {
164 self.sys.draggable
165 }
166 pub fn set_draggable(&mut self, value: bool) {
168 self.sys.draggable = value;
169 }
170 pub fn enter_key_hint(&self) -> std::option::Option<&str> {
172 self.sys.enter_key_hint.as_deref()
173 }
174 pub fn set_enter_key_hint(
176 &mut self,
177 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
178 ) {
179 self.sys.enter_key_hint = value.map(|v| v.into());
180 }
181 pub fn export_parts(&self) -> std::option::Option<&str> {
183 self.sys.export_parts.as_deref()
184 }
185 pub fn set_export_parts(
187 &mut self,
188 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
189 ) {
190 self.sys.export_parts = value.map(|v| v.into());
191 }
192 pub fn hidden(&self) -> std::option::Option<&str> {
194 self.sys.hidden.as_deref()
195 }
196 pub fn set_hidden(
198 &mut self,
199 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
200 ) {
201 self.sys.hidden = value.map(|v| v.into());
202 }
203 pub fn id(&self) -> std::option::Option<&str> {
205 self.sys.id.as_deref()
206 }
207 pub fn set_id(
209 &mut self,
210 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
211 ) {
212 self.sys.id = value.map(|v| v.into());
213 }
214 pub fn inert(&self) -> bool {
216 self.sys.inert
217 }
218 pub fn set_inert(&mut self, value: bool) {
220 self.sys.inert = value;
221 }
222 pub fn input_mode(&self) -> std::option::Option<&str> {
224 self.sys.input_mode.as_deref()
225 }
226 pub fn set_input_mode(
228 &mut self,
229 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
230 ) {
231 self.sys.input_mode = value.map(|v| v.into());
232 }
233 pub fn is_(&self) -> std::option::Option<&str> {
235 self.sys.is_.as_deref()
236 }
237 pub fn set_is_(
239 &mut self,
240 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
241 ) {
242 self.sys.is_ = value.map(|v| v.into());
243 }
244 pub fn item_id(&self) -> std::option::Option<&str> {
246 self.sys.item_id.as_deref()
247 }
248 pub fn set_item_id(
250 &mut self,
251 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
252 ) {
253 self.sys.item_id = value.map(|v| v.into());
254 }
255 pub fn item_prop(&self) -> std::option::Option<&str> {
257 self.sys.item_prop.as_deref()
258 }
259 pub fn set_item_prop(
261 &mut self,
262 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
263 ) {
264 self.sys.item_prop = value.map(|v| v.into());
265 }
266 pub fn item_ref(&self) -> std::option::Option<&str> {
268 self.sys.item_ref.as_deref()
269 }
270 pub fn set_item_ref(
272 &mut self,
273 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
274 ) {
275 self.sys.item_ref = value.map(|v| v.into());
276 }
277 pub fn item_scope(&self) -> std::option::Option<&str> {
279 self.sys.item_scope.as_deref()
280 }
281 pub fn set_item_scope(
283 &mut self,
284 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
285 ) {
286 self.sys.item_scope = value.map(|v| v.into());
287 }
288 pub fn item_type(&self) -> std::option::Option<&str> {
290 self.sys.item_type.as_deref()
291 }
292 pub fn set_item_type(
294 &mut self,
295 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
296 ) {
297 self.sys.item_type = value.map(|v| v.into());
298 }
299 pub fn lang(&self) -> std::option::Option<&str> {
301 self.sys.lang.as_deref()
302 }
303 pub fn set_lang(
305 &mut self,
306 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
307 ) {
308 self.sys.lang = value.map(|v| v.into());
309 }
310 pub fn nonce(&self) -> std::option::Option<&str> {
312 self.sys.nonce.as_deref()
313 }
314 pub fn set_nonce(
316 &mut self,
317 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
318 ) {
319 self.sys.nonce = value.map(|v| v.into());
320 }
321 pub fn part(&self) -> std::option::Option<&str> {
323 self.sys.part.as_deref()
324 }
325 pub fn set_part(
327 &mut self,
328 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
329 ) {
330 self.sys.part = value.map(|v| v.into());
331 }
332 pub fn slot(&self) -> std::option::Option<&str> {
334 self.sys.slot.as_deref()
335 }
336 pub fn set_slot(
338 &mut self,
339 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
340 ) {
341 self.sys.slot = value.map(|v| v.into());
342 }
343 pub fn spellcheck(&self) -> std::option::Option<&str> {
345 self.sys.spellcheck.as_deref()
346 }
347 pub fn set_spellcheck(
349 &mut self,
350 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
351 ) {
352 self.sys.spellcheck = value.map(|v| v.into());
353 }
354 pub fn style(&self) -> std::option::Option<&str> {
356 self.sys.style.as_deref()
357 }
358 pub fn set_style(
360 &mut self,
361 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
362 ) {
363 self.sys.style = value.map(|v| v.into());
364 }
365 pub fn tab_index(&self) -> std::option::Option<i64> {
367 self.sys.tab_index
368 }
369 pub fn set_tab_index(&mut self, value: std::option::Option<i64>) {
371 self.sys.tab_index = value;
372 }
373 pub fn title(&self) -> std::option::Option<&str> {
375 self.sys.title.as_deref()
376 }
377 pub fn set_title(
379 &mut self,
380 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
381 ) {
382 self.sys.title = value.map(|v| v.into());
383 }
384 pub fn translate(&self) -> bool {
386 self.sys.translate
387 }
388 pub fn set_translate(&mut self, value: bool) {
390 self.sys.translate = value;
391 }
392 }
393 impl crate::Render for MediaSource {
394 fn render(
395 &self,
396 f: &mut std::fmt::Formatter<'_>,
397 depth: usize,
398 ) -> std::fmt::Result {
399 write!(f, "{:level$}", "", level = depth * 4)?;
400 html_sys::RenderElement::write_opening_tag(&self.sys, f)?;
401 Ok(())
402 }
403 }
404 impl std::fmt::Debug for MediaSource {
405 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
406 crate::Render::render(self, f, 0)?;
407 Ok(())
408 }
409 }
410 impl std::fmt::Display for MediaSource {
411 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
412 html_sys::RenderElement::write_opening_tag(&self.sys, f)?;
413 html_sys::RenderElement::write_closing_tag(&self.sys, f)?;
414 Ok(())
415 }
416 }
417 impl crate::HtmlElement for MediaSource {}
418 impl std::convert::Into<html_sys::embedded::MediaSource> for MediaSource {
419 fn into(self) -> html_sys::embedded::MediaSource {
420 self.sys
421 }
422 }
423 impl From<html_sys::embedded::MediaSource> for MediaSource {
424 fn from(sys: html_sys::embedded::MediaSource) -> Self {
425 Self { sys }
426 }
427 }
428}
429pub mod child {}
430pub mod builder {
431 pub struct MediaSourceBuilder {
433 element: super::element::MediaSource,
434 }
435 impl MediaSourceBuilder {
436 pub(crate) fn new(element: super::element::MediaSource) -> Self {
437 Self { element }
438 }
439 pub fn build(&mut self) -> super::element::MediaSource {
441 self.element.clone()
442 }
443 pub fn data(
445 &mut self,
446 data_key: impl Into<std::borrow::Cow<'static, str>>,
447 value: impl Into<std::borrow::Cow<'static, str>>,
448 ) -> &mut MediaSourceBuilder {
449 self.element.data_map_mut().insert(data_key.into(), value.into());
450 self
451 }
452 pub fn type_(
454 &mut self,
455 value: impl Into<std::borrow::Cow<'static, str>>,
456 ) -> &mut Self {
457 self.element.set_type_(Some(value.into()));
458 self
459 }
460 pub fn media(
462 &mut self,
463 value: impl Into<std::borrow::Cow<'static, str>>,
464 ) -> &mut Self {
465 self.element.set_media(Some(value.into()));
466 self
467 }
468 pub fn src(
470 &mut self,
471 value: impl Into<std::borrow::Cow<'static, str>>,
472 ) -> &mut Self {
473 self.element.set_src(Some(value.into()));
474 self
475 }
476 pub fn srcset(
478 &mut self,
479 value: impl Into<std::borrow::Cow<'static, str>>,
480 ) -> &mut Self {
481 self.element.set_srcset(Some(value.into()));
482 self
483 }
484 pub fn sizes(
486 &mut self,
487 value: impl Into<std::borrow::Cow<'static, str>>,
488 ) -> &mut Self {
489 self.element.set_sizes(Some(value.into()));
490 self
491 }
492 pub fn width(&mut self, value: i64) -> &mut Self {
494 self.element.set_width(Some(value));
495 self
496 }
497 pub fn height(&mut self, value: i64) -> &mut Self {
499 self.element.set_height(Some(value));
500 self
501 }
502 pub fn access_key(
504 &mut self,
505 value: impl Into<std::borrow::Cow<'static, str>>,
506 ) -> &mut Self {
507 self.element.set_access_key(Some(value.into()));
508 self
509 }
510 pub fn auto_capitalize(
512 &mut self,
513 value: impl Into<std::borrow::Cow<'static, str>>,
514 ) -> &mut Self {
515 self.element.set_auto_capitalize(Some(value.into()));
516 self
517 }
518 pub fn autofocus(&mut self, value: bool) -> &mut Self {
520 self.element.set_autofocus(value);
521 self
522 }
523 pub fn class(
525 &mut self,
526 value: impl Into<std::borrow::Cow<'static, str>>,
527 ) -> &mut Self {
528 self.element.set_class(Some(value.into()));
529 self
530 }
531 pub fn content_editable(
533 &mut self,
534 value: impl Into<std::borrow::Cow<'static, str>>,
535 ) -> &mut Self {
536 self.element.set_content_editable(Some(value.into()));
537 self
538 }
539 pub fn direction(
541 &mut self,
542 value: impl Into<std::borrow::Cow<'static, str>>,
543 ) -> &mut Self {
544 self.element.set_direction(Some(value.into()));
545 self
546 }
547 pub fn draggable(&mut self, value: bool) -> &mut Self {
549 self.element.set_draggable(value);
550 self
551 }
552 pub fn enter_key_hint(
554 &mut self,
555 value: impl Into<std::borrow::Cow<'static, str>>,
556 ) -> &mut Self {
557 self.element.set_enter_key_hint(Some(value.into()));
558 self
559 }
560 pub fn export_parts(
562 &mut self,
563 value: impl Into<std::borrow::Cow<'static, str>>,
564 ) -> &mut Self {
565 self.element.set_export_parts(Some(value.into()));
566 self
567 }
568 pub fn hidden(
570 &mut self,
571 value: impl Into<std::borrow::Cow<'static, str>>,
572 ) -> &mut Self {
573 self.element.set_hidden(Some(value.into()));
574 self
575 }
576 pub fn id(
578 &mut self,
579 value: impl Into<std::borrow::Cow<'static, str>>,
580 ) -> &mut Self {
581 self.element.set_id(Some(value.into()));
582 self
583 }
584 pub fn inert(&mut self, value: bool) -> &mut Self {
586 self.element.set_inert(value);
587 self
588 }
589 pub fn input_mode(
591 &mut self,
592 value: impl Into<std::borrow::Cow<'static, str>>,
593 ) -> &mut Self {
594 self.element.set_input_mode(Some(value.into()));
595 self
596 }
597 pub fn is_(
599 &mut self,
600 value: impl Into<std::borrow::Cow<'static, str>>,
601 ) -> &mut Self {
602 self.element.set_is_(Some(value.into()));
603 self
604 }
605 pub fn item_id(
607 &mut self,
608 value: impl Into<std::borrow::Cow<'static, str>>,
609 ) -> &mut Self {
610 self.element.set_item_id(Some(value.into()));
611 self
612 }
613 pub fn item_prop(
615 &mut self,
616 value: impl Into<std::borrow::Cow<'static, str>>,
617 ) -> &mut Self {
618 self.element.set_item_prop(Some(value.into()));
619 self
620 }
621 pub fn item_ref(
623 &mut self,
624 value: impl Into<std::borrow::Cow<'static, str>>,
625 ) -> &mut Self {
626 self.element.set_item_ref(Some(value.into()));
627 self
628 }
629 pub fn item_scope(
631 &mut self,
632 value: impl Into<std::borrow::Cow<'static, str>>,
633 ) -> &mut Self {
634 self.element.set_item_scope(Some(value.into()));
635 self
636 }
637 pub fn item_type(
639 &mut self,
640 value: impl Into<std::borrow::Cow<'static, str>>,
641 ) -> &mut Self {
642 self.element.set_item_type(Some(value.into()));
643 self
644 }
645 pub fn lang(
647 &mut self,
648 value: impl Into<std::borrow::Cow<'static, str>>,
649 ) -> &mut Self {
650 self.element.set_lang(Some(value.into()));
651 self
652 }
653 pub fn nonce(
655 &mut self,
656 value: impl Into<std::borrow::Cow<'static, str>>,
657 ) -> &mut Self {
658 self.element.set_nonce(Some(value.into()));
659 self
660 }
661 pub fn part(
663 &mut self,
664 value: impl Into<std::borrow::Cow<'static, str>>,
665 ) -> &mut Self {
666 self.element.set_part(Some(value.into()));
667 self
668 }
669 pub fn slot(
671 &mut self,
672 value: impl Into<std::borrow::Cow<'static, str>>,
673 ) -> &mut Self {
674 self.element.set_slot(Some(value.into()));
675 self
676 }
677 pub fn spellcheck(
679 &mut self,
680 value: impl Into<std::borrow::Cow<'static, str>>,
681 ) -> &mut Self {
682 self.element.set_spellcheck(Some(value.into()));
683 self
684 }
685 pub fn style(
687 &mut self,
688 value: impl Into<std::borrow::Cow<'static, str>>,
689 ) -> &mut Self {
690 self.element.set_style(Some(value.into()));
691 self
692 }
693 pub fn tab_index(&mut self, value: i64) -> &mut Self {
695 self.element.set_tab_index(Some(value));
696 self
697 }
698 pub fn title(
700 &mut self,
701 value: impl Into<std::borrow::Cow<'static, str>>,
702 ) -> &mut Self {
703 self.element.set_title(Some(value.into()));
704 self
705 }
706 pub fn translate(&mut self, value: bool) -> &mut Self {
708 self.element.set_translate(value);
709 self
710 }
711 }
712}