mathml_core/identifiers/
constructors.rs1use super::*;
2
3impl MathIdentifier {
4 pub fn new<S>(text: S, variant: FontVariant) -> Self
6 where
7 S: ToString,
8 {
9 Self { identifier: text.to_string(), variant }
10 }
11 pub fn normal<S>(text: S) -> Self
13 where
14 S: ToString,
15 {
16 Self { identifier: text.to_string(), variant: FontVariant::Normal }
17 }
18 pub fn italic<S>(text: S) -> Self
20 where
21 S: ToString,
22 {
23 Self { identifier: text.to_string(), variant: FontVariant::Italic }
24 }
25 pub fn get_variant(&self) -> FontVariant {
27 self.variant
28 }
29 pub fn get_identifier(&self) -> &str {
31 &self.identifier
32 }
33}
34
35impl MathText {
36 pub fn text<S>(text: S) -> Self
38 where
39 S: ToString,
40 {
41 Self { text: text.to_string(), is_string: false }
42 }
43 pub fn string<S>(text: S) -> Self
45 where
46 S: ToString,
47 {
48 Self { text: text.to_string(), is_string: true }
49 }
50}
51
52impl MathML {
53 pub fn identifier<S>(text: S) -> Self
55 where
56 S: ToString,
57 {
58 MathIdentifier::italic(text).into()
59 }
60 pub fn text<S>(text: S) -> Self
62 where
63 S: ToString,
64 {
65 MathText::text(text).into()
66 }
67 pub fn string<S>(text: S) -> Self
69 where
70 S: ToString,
71 {
72 MathText::string(text).into()
73 }
74}