1pub mod element {
2 #[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 pub fn builder() -> super::builder::MetaBuilder {
14 super::builder::MetaBuilder::new(Default::default())
15 }
16 }
17 impl Meta {
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 Meta {
28 pub fn name(&self) -> std::option::Option<&str> {
30 self.sys.name.as_deref()
31 }
32 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 pub fn http_equiv(&self) -> std::option::Option<&str> {
41 self.sys.http_equiv.as_deref()
42 }
43 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 pub fn content(&self) -> std::option::Option<&str> {
52 self.sys.content.as_deref()
53 }
54 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 pub fn charset(&self) -> std::option::Option<&str> {
63 self.sys.charset.as_deref()
64 }
65 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 pub fn media(&self) -> std::option::Option<&str> {
74 self.sys.media.as_deref()
75 }
76 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 pub fn access_key(&self) -> std::option::Option<&str> {
85 self.sys.access_key.as_deref()
86 }
87 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 pub fn auto_capitalize(&self) -> std::option::Option<&str> {
96 self.sys.auto_capitalize.as_deref()
97 }
98 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 pub fn autofocus(&self) -> bool {
107 self.sys.autofocus
108 }
109 pub fn set_autofocus(&mut self, value: bool) {
111 self.sys.autofocus = value;
112 }
113 pub fn class(&self) -> std::option::Option<&str> {
115 self.sys.class.as_deref()
116 }
117 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 pub fn content_editable(&self) -> std::option::Option<&str> {
126 self.sys.content_editable.as_deref()
127 }
128 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 pub fn direction(&self) -> std::option::Option<&str> {
137 self.sys.direction.as_deref()
138 }
139 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 pub fn draggable(&self) -> bool {
148 self.sys.draggable
149 }
150 pub fn set_draggable(&mut self, value: bool) {
152 self.sys.draggable = value;
153 }
154 pub fn enter_key_hint(&self) -> std::option::Option<&str> {
156 self.sys.enter_key_hint.as_deref()
157 }
158 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 pub fn export_parts(&self) -> std::option::Option<&str> {
167 self.sys.export_parts.as_deref()
168 }
169 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 pub fn hidden(&self) -> std::option::Option<&str> {
178 self.sys.hidden.as_deref()
179 }
180 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 pub fn id(&self) -> std::option::Option<&str> {
189 self.sys.id.as_deref()
190 }
191 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 pub fn inert(&self) -> bool {
200 self.sys.inert
201 }
202 pub fn set_inert(&mut self, value: bool) {
204 self.sys.inert = value;
205 }
206 pub fn input_mode(&self) -> std::option::Option<&str> {
208 self.sys.input_mode.as_deref()
209 }
210 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 pub fn is_(&self) -> std::option::Option<&str> {
219 self.sys.is_.as_deref()
220 }
221 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 pub fn item_id(&self) -> std::option::Option<&str> {
230 self.sys.item_id.as_deref()
231 }
232 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 pub fn item_prop(&self) -> std::option::Option<&str> {
241 self.sys.item_prop.as_deref()
242 }
243 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 pub fn item_ref(&self) -> std::option::Option<&str> {
252 self.sys.item_ref.as_deref()
253 }
254 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 pub fn item_scope(&self) -> std::option::Option<&str> {
263 self.sys.item_scope.as_deref()
264 }
265 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 pub fn item_type(&self) -> std::option::Option<&str> {
274 self.sys.item_type.as_deref()
275 }
276 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 pub fn lang(&self) -> std::option::Option<&str> {
285 self.sys.lang.as_deref()
286 }
287 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 pub fn nonce(&self) -> std::option::Option<&str> {
296 self.sys.nonce.as_deref()
297 }
298 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 pub fn part(&self) -> std::option::Option<&str> {
307 self.sys.part.as_deref()
308 }
309 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 pub fn slot(&self) -> std::option::Option<&str> {
318 self.sys.slot.as_deref()
319 }
320 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 pub fn spellcheck(&self) -> std::option::Option<&str> {
329 self.sys.spellcheck.as_deref()
330 }
331 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 pub fn style(&self) -> std::option::Option<&str> {
340 self.sys.style.as_deref()
341 }
342 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 pub fn tab_index(&self) -> std::option::Option<i64> {
351 self.sys.tab_index
352 }
353 pub fn set_tab_index(&mut self, value: std::option::Option<i64>) {
355 self.sys.tab_index = value;
356 }
357 pub fn title(&self) -> std::option::Option<&str> {
359 self.sys.title.as_deref()
360 }
361 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 pub fn translate(&self) -> bool {
370 self.sys.translate
371 }
372 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 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 pub fn build(&mut self) -> super::element::Meta {
428 self.element.clone()
429 }
430 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 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 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 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 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 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 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 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 pub fn autofocus(&mut self, value: bool) -> &mut Self {
497 self.element.set_autofocus(value);
498 self
499 }
500 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 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 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 pub fn draggable(&mut self, value: bool) -> &mut Self {
526 self.element.set_draggable(value);
527 self
528 }
529 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 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 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 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 pub fn inert(&mut self, value: bool) -> &mut Self {
563 self.element.set_inert(value);
564 self
565 }
566 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 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 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 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 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 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 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 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 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 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 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 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 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 pub fn tab_index(&mut self, value: i64) -> &mut Self {
672 self.element.set_tab_index(Some(value));
673 self
674 }
675 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 pub fn translate(&mut self, value: bool) -> &mut Self {
685 self.element.set_translate(value);
686 self
687 }
688 }
689}