1pub mod element {
2 #[doc(alias = "base")]
6 #[non_exhaustive]
7 #[derive(PartialEq, Clone, Default)]
8 pub struct Base {
9 sys: html_sys::metadata::Base,
10 }
11 impl Base {
12 pub fn builder() -> super::builder::BaseBuilder {
14 super::builder::BaseBuilder::new(Default::default())
15 }
16 }
17 impl Base {
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 Base {
28 pub fn href(&self) -> std::option::Option<&str> {
30 self.sys.href.as_deref()
31 }
32 pub fn set_href(
34 &mut self,
35 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
36 ) {
37 self.sys.href = value.map(|v| v.into());
38 }
39 pub fn target(&self) -> std::option::Option<&str> {
41 self.sys.target.as_deref()
42 }
43 pub fn set_target(
45 &mut self,
46 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
47 ) {
48 self.sys.target = value.map(|v| v.into());
49 }
50 pub fn access_key(&self) -> std::option::Option<&str> {
52 self.sys.access_key.as_deref()
53 }
54 pub fn set_access_key(
56 &mut self,
57 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
58 ) {
59 self.sys.access_key = value.map(|v| v.into());
60 }
61 pub fn auto_capitalize(&self) -> std::option::Option<&str> {
63 self.sys.auto_capitalize.as_deref()
64 }
65 pub fn set_auto_capitalize(
67 &mut self,
68 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
69 ) {
70 self.sys.auto_capitalize = value.map(|v| v.into());
71 }
72 pub fn autofocus(&self) -> bool {
74 self.sys.autofocus
75 }
76 pub fn set_autofocus(&mut self, value: bool) {
78 self.sys.autofocus = value;
79 }
80 pub fn class(&self) -> std::option::Option<&str> {
82 self.sys.class.as_deref()
83 }
84 pub fn set_class(
86 &mut self,
87 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
88 ) {
89 self.sys.class = value.map(|v| v.into());
90 }
91 pub fn content_editable(&self) -> std::option::Option<&str> {
93 self.sys.content_editable.as_deref()
94 }
95 pub fn set_content_editable(
97 &mut self,
98 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
99 ) {
100 self.sys.content_editable = value.map(|v| v.into());
101 }
102 pub fn direction(&self) -> std::option::Option<&str> {
104 self.sys.direction.as_deref()
105 }
106 pub fn set_direction(
108 &mut self,
109 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
110 ) {
111 self.sys.direction = value.map(|v| v.into());
112 }
113 pub fn draggable(&self) -> bool {
115 self.sys.draggable
116 }
117 pub fn set_draggable(&mut self, value: bool) {
119 self.sys.draggable = value;
120 }
121 pub fn enter_key_hint(&self) -> std::option::Option<&str> {
123 self.sys.enter_key_hint.as_deref()
124 }
125 pub fn set_enter_key_hint(
127 &mut self,
128 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
129 ) {
130 self.sys.enter_key_hint = value.map(|v| v.into());
131 }
132 pub fn export_parts(&self) -> std::option::Option<&str> {
134 self.sys.export_parts.as_deref()
135 }
136 pub fn set_export_parts(
138 &mut self,
139 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
140 ) {
141 self.sys.export_parts = value.map(|v| v.into());
142 }
143 pub fn hidden(&self) -> std::option::Option<&str> {
145 self.sys.hidden.as_deref()
146 }
147 pub fn set_hidden(
149 &mut self,
150 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
151 ) {
152 self.sys.hidden = value.map(|v| v.into());
153 }
154 pub fn id(&self) -> std::option::Option<&str> {
156 self.sys.id.as_deref()
157 }
158 pub fn set_id(
160 &mut self,
161 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
162 ) {
163 self.sys.id = value.map(|v| v.into());
164 }
165 pub fn inert(&self) -> bool {
167 self.sys.inert
168 }
169 pub fn set_inert(&mut self, value: bool) {
171 self.sys.inert = value;
172 }
173 pub fn input_mode(&self) -> std::option::Option<&str> {
175 self.sys.input_mode.as_deref()
176 }
177 pub fn set_input_mode(
179 &mut self,
180 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
181 ) {
182 self.sys.input_mode = value.map(|v| v.into());
183 }
184 pub fn is_(&self) -> std::option::Option<&str> {
186 self.sys.is_.as_deref()
187 }
188 pub fn set_is_(
190 &mut self,
191 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
192 ) {
193 self.sys.is_ = value.map(|v| v.into());
194 }
195 pub fn item_id(&self) -> std::option::Option<&str> {
197 self.sys.item_id.as_deref()
198 }
199 pub fn set_item_id(
201 &mut self,
202 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
203 ) {
204 self.sys.item_id = value.map(|v| v.into());
205 }
206 pub fn item_prop(&self) -> std::option::Option<&str> {
208 self.sys.item_prop.as_deref()
209 }
210 pub fn set_item_prop(
212 &mut self,
213 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
214 ) {
215 self.sys.item_prop = value.map(|v| v.into());
216 }
217 pub fn item_ref(&self) -> std::option::Option<&str> {
219 self.sys.item_ref.as_deref()
220 }
221 pub fn set_item_ref(
223 &mut self,
224 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
225 ) {
226 self.sys.item_ref = value.map(|v| v.into());
227 }
228 pub fn item_scope(&self) -> std::option::Option<&str> {
230 self.sys.item_scope.as_deref()
231 }
232 pub fn set_item_scope(
234 &mut self,
235 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
236 ) {
237 self.sys.item_scope = value.map(|v| v.into());
238 }
239 pub fn item_type(&self) -> std::option::Option<&str> {
241 self.sys.item_type.as_deref()
242 }
243 pub fn set_item_type(
245 &mut self,
246 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
247 ) {
248 self.sys.item_type = value.map(|v| v.into());
249 }
250 pub fn lang(&self) -> std::option::Option<&str> {
252 self.sys.lang.as_deref()
253 }
254 pub fn set_lang(
256 &mut self,
257 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
258 ) {
259 self.sys.lang = value.map(|v| v.into());
260 }
261 pub fn nonce(&self) -> std::option::Option<&str> {
263 self.sys.nonce.as_deref()
264 }
265 pub fn set_nonce(
267 &mut self,
268 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
269 ) {
270 self.sys.nonce = value.map(|v| v.into());
271 }
272 pub fn part(&self) -> std::option::Option<&str> {
274 self.sys.part.as_deref()
275 }
276 pub fn set_part(
278 &mut self,
279 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
280 ) {
281 self.sys.part = value.map(|v| v.into());
282 }
283 pub fn slot(&self) -> std::option::Option<&str> {
285 self.sys.slot.as_deref()
286 }
287 pub fn set_slot(
289 &mut self,
290 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
291 ) {
292 self.sys.slot = value.map(|v| v.into());
293 }
294 pub fn spellcheck(&self) -> std::option::Option<&str> {
296 self.sys.spellcheck.as_deref()
297 }
298 pub fn set_spellcheck(
300 &mut self,
301 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
302 ) {
303 self.sys.spellcheck = value.map(|v| v.into());
304 }
305 pub fn style(&self) -> std::option::Option<&str> {
307 self.sys.style.as_deref()
308 }
309 pub fn set_style(
311 &mut self,
312 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
313 ) {
314 self.sys.style = value.map(|v| v.into());
315 }
316 pub fn tab_index(&self) -> std::option::Option<i64> {
318 self.sys.tab_index
319 }
320 pub fn set_tab_index(&mut self, value: std::option::Option<i64>) {
322 self.sys.tab_index = value;
323 }
324 pub fn title(&self) -> std::option::Option<&str> {
326 self.sys.title.as_deref()
327 }
328 pub fn set_title(
330 &mut self,
331 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
332 ) {
333 self.sys.title = value.map(|v| v.into());
334 }
335 pub fn translate(&self) -> bool {
337 self.sys.translate
338 }
339 pub fn set_translate(&mut self, value: bool) {
341 self.sys.translate = value;
342 }
343 }
344 impl crate::Render for Base {
345 fn render(
346 &self,
347 f: &mut std::fmt::Formatter<'_>,
348 depth: usize,
349 ) -> std::fmt::Result {
350 write!(f, "{:level$}", "", level = depth * 4)?;
351 html_sys::RenderElement::write_opening_tag(&self.sys, f)?;
352 Ok(())
353 }
354 }
355 impl std::fmt::Debug for Base {
356 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
357 crate::Render::render(self, f, 0)?;
358 Ok(())
359 }
360 }
361 impl std::fmt::Display for Base {
362 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
363 html_sys::RenderElement::write_opening_tag(&self.sys, f)?;
364 html_sys::RenderElement::write_closing_tag(&self.sys, f)?;
365 Ok(())
366 }
367 }
368 impl crate::HtmlElement for Base {}
369 impl crate::MetadataContent for Base {}
370 impl std::convert::Into<html_sys::metadata::Base> for Base {
371 fn into(self) -> html_sys::metadata::Base {
372 self.sys
373 }
374 }
375 impl From<html_sys::metadata::Base> for Base {
376 fn from(sys: html_sys::metadata::Base) -> Self {
377 Self { sys }
378 }
379 }
380}
381pub mod child {}
382pub mod builder {
383 pub struct BaseBuilder {
385 element: super::element::Base,
386 }
387 impl BaseBuilder {
388 pub(crate) fn new(element: super::element::Base) -> Self {
389 Self { element }
390 }
391 pub fn build(&mut self) -> super::element::Base {
393 self.element.clone()
394 }
395 pub fn data(
397 &mut self,
398 data_key: impl Into<std::borrow::Cow<'static, str>>,
399 value: impl Into<std::borrow::Cow<'static, str>>,
400 ) -> &mut BaseBuilder {
401 self.element.data_map_mut().insert(data_key.into(), value.into());
402 self
403 }
404 pub fn href(
406 &mut self,
407 value: impl Into<std::borrow::Cow<'static, str>>,
408 ) -> &mut Self {
409 self.element.set_href(Some(value.into()));
410 self
411 }
412 pub fn target(
414 &mut self,
415 value: impl Into<std::borrow::Cow<'static, str>>,
416 ) -> &mut Self {
417 self.element.set_target(Some(value.into()));
418 self
419 }
420 pub fn access_key(
422 &mut self,
423 value: impl Into<std::borrow::Cow<'static, str>>,
424 ) -> &mut Self {
425 self.element.set_access_key(Some(value.into()));
426 self
427 }
428 pub fn auto_capitalize(
430 &mut self,
431 value: impl Into<std::borrow::Cow<'static, str>>,
432 ) -> &mut Self {
433 self.element.set_auto_capitalize(Some(value.into()));
434 self
435 }
436 pub fn autofocus(&mut self, value: bool) -> &mut Self {
438 self.element.set_autofocus(value);
439 self
440 }
441 pub fn class(
443 &mut self,
444 value: impl Into<std::borrow::Cow<'static, str>>,
445 ) -> &mut Self {
446 self.element.set_class(Some(value.into()));
447 self
448 }
449 pub fn content_editable(
451 &mut self,
452 value: impl Into<std::borrow::Cow<'static, str>>,
453 ) -> &mut Self {
454 self.element.set_content_editable(Some(value.into()));
455 self
456 }
457 pub fn direction(
459 &mut self,
460 value: impl Into<std::borrow::Cow<'static, str>>,
461 ) -> &mut Self {
462 self.element.set_direction(Some(value.into()));
463 self
464 }
465 pub fn draggable(&mut self, value: bool) -> &mut Self {
467 self.element.set_draggable(value);
468 self
469 }
470 pub fn enter_key_hint(
472 &mut self,
473 value: impl Into<std::borrow::Cow<'static, str>>,
474 ) -> &mut Self {
475 self.element.set_enter_key_hint(Some(value.into()));
476 self
477 }
478 pub fn export_parts(
480 &mut self,
481 value: impl Into<std::borrow::Cow<'static, str>>,
482 ) -> &mut Self {
483 self.element.set_export_parts(Some(value.into()));
484 self
485 }
486 pub fn hidden(
488 &mut self,
489 value: impl Into<std::borrow::Cow<'static, str>>,
490 ) -> &mut Self {
491 self.element.set_hidden(Some(value.into()));
492 self
493 }
494 pub fn id(
496 &mut self,
497 value: impl Into<std::borrow::Cow<'static, str>>,
498 ) -> &mut Self {
499 self.element.set_id(Some(value.into()));
500 self
501 }
502 pub fn inert(&mut self, value: bool) -> &mut Self {
504 self.element.set_inert(value);
505 self
506 }
507 pub fn input_mode(
509 &mut self,
510 value: impl Into<std::borrow::Cow<'static, str>>,
511 ) -> &mut Self {
512 self.element.set_input_mode(Some(value.into()));
513 self
514 }
515 pub fn is_(
517 &mut self,
518 value: impl Into<std::borrow::Cow<'static, str>>,
519 ) -> &mut Self {
520 self.element.set_is_(Some(value.into()));
521 self
522 }
523 pub fn item_id(
525 &mut self,
526 value: impl Into<std::borrow::Cow<'static, str>>,
527 ) -> &mut Self {
528 self.element.set_item_id(Some(value.into()));
529 self
530 }
531 pub fn item_prop(
533 &mut self,
534 value: impl Into<std::borrow::Cow<'static, str>>,
535 ) -> &mut Self {
536 self.element.set_item_prop(Some(value.into()));
537 self
538 }
539 pub fn item_ref(
541 &mut self,
542 value: impl Into<std::borrow::Cow<'static, str>>,
543 ) -> &mut Self {
544 self.element.set_item_ref(Some(value.into()));
545 self
546 }
547 pub fn item_scope(
549 &mut self,
550 value: impl Into<std::borrow::Cow<'static, str>>,
551 ) -> &mut Self {
552 self.element.set_item_scope(Some(value.into()));
553 self
554 }
555 pub fn item_type(
557 &mut self,
558 value: impl Into<std::borrow::Cow<'static, str>>,
559 ) -> &mut Self {
560 self.element.set_item_type(Some(value.into()));
561 self
562 }
563 pub fn lang(
565 &mut self,
566 value: impl Into<std::borrow::Cow<'static, str>>,
567 ) -> &mut Self {
568 self.element.set_lang(Some(value.into()));
569 self
570 }
571 pub fn nonce(
573 &mut self,
574 value: impl Into<std::borrow::Cow<'static, str>>,
575 ) -> &mut Self {
576 self.element.set_nonce(Some(value.into()));
577 self
578 }
579 pub fn part(
581 &mut self,
582 value: impl Into<std::borrow::Cow<'static, str>>,
583 ) -> &mut Self {
584 self.element.set_part(Some(value.into()));
585 self
586 }
587 pub fn slot(
589 &mut self,
590 value: impl Into<std::borrow::Cow<'static, str>>,
591 ) -> &mut Self {
592 self.element.set_slot(Some(value.into()));
593 self
594 }
595 pub fn spellcheck(
597 &mut self,
598 value: impl Into<std::borrow::Cow<'static, str>>,
599 ) -> &mut Self {
600 self.element.set_spellcheck(Some(value.into()));
601 self
602 }
603 pub fn style(
605 &mut self,
606 value: impl Into<std::borrow::Cow<'static, str>>,
607 ) -> &mut Self {
608 self.element.set_style(Some(value.into()));
609 self
610 }
611 pub fn tab_index(&mut self, value: i64) -> &mut Self {
613 self.element.set_tab_index(Some(value));
614 self
615 }
616 pub fn title(
618 &mut self,
619 value: impl Into<std::borrow::Cow<'static, str>>,
620 ) -> &mut Self {
621 self.element.set_title(Some(value.into()));
622 self
623 }
624 pub fn translate(&mut self, value: bool) -> &mut Self {
626 self.element.set_translate(value);
627 self
628 }
629 }
630}