htmlstream/
base.rs

1/// The HTML source position
2///
3/// # Examples
4/// ```
5/// # use self::htmlstream::*;
6/// let pos = Position {
7///     start: 0,
8///     end: 10,
9/// };
10/// ```
11#[derive(Debug, PartialEq)]
12pub struct Position {
13    pub start: usize,
14    pub end: usize,
15}
16
17/// The tag state
18///
19/// + `Text`: not a HTML tag, e.g. hello
20/// + `Opening`: an opening tag, e.g. <a href="#">
21/// + `Closing`: a closing tag, e.g. </a>
22/// + `SelfClosing`: a selfclosing tag,e.g. <br />
23#[derive(Debug, PartialEq)]
24pub enum HTMLTagState {
25    Text, Opening, Closing, SelfClosing
26}
27
28/// The HTML tag
29///
30/// # Examples
31///
32/// ```
33/// # use self::htmlstream::*;
34/// let tag = HTMLTag {
35///     name: "a".to_string(),
36///     html: "<a href=\"#\">link</a>".to_string(),
37///     attributes: "href=\"#\"".to_string(),
38///     state: HTMLTagState::Opening,
39/// };
40/// ```
41#[derive(Debug, PartialEq)]
42pub struct HTMLTag {
43    pub name: String,
44    pub html: String,
45    pub attributes: String,
46    pub state: HTMLTagState
47}
48
49/// The tag attribute
50///
51/// # Examples
52///
53/// ```
54/// # use self::htmlstream::*;
55/// let attr = HTMLTagAttribute {
56///     name: "href".to_string(),
57///     value: "#".to_string(),
58/// };
59/// ```
60#[derive(Debug, PartialEq)]
61pub struct HTMLTagAttribute {
62    pub name: String,
63    pub value: String,
64}