diff --git a/file-service/src/html.rs b/file-service/src/html.rs
index c545e6a..9d293f4 100644
--- a/file-service/src/html.rs
+++ b/file-service/src/html.rs
@@ -1,8 +1,40 @@
use build_html::{self, Html, HtmlContainer};
+#[derive(Clone, Debug, Default)]
+pub struct Attributes(Vec<(String, String)>);
+
+/*
+impl FromIterator<(String, String)> for Attributes {
+ fn from_iter(iter: T) -> Self
+ where
+ T: IntoIterator- ,
+ {
+ Attributes(iter.collect::>())
+ }
+}
+
+impl FromIterator<(&str, &str)> for Attributes {
+ fn from_iter(iter: T) -> Self
+ where
+ T: IntoIterator
- ,
+ {
+ unimplemented!()
+ }
+}
+*/
+
+impl ToString for Attributes {
+ fn to_string(&self) -> String {
+ self.0
+ .iter()
+ .map(|(key, value)| format!("{}=\"{}\"", key, value))
+ .collect::>()
+ .join(" ")
+ }
+}
+
#[derive(Clone, Debug)]
pub struct Form {
- classes: Option,
path: String,
method: String,
encoding: Option,
@@ -12,7 +44,6 @@ pub struct Form {
impl Form {
pub fn new() -> Self {
Self {
- classes: None,
path: "/".to_owned(),
method: "get".to_owned(),
encoding: None,
@@ -38,21 +69,16 @@ impl Form {
impl Html for Form {
fn to_html_string(&self) -> String {
- let classes = match self.classes {
- Some(ref classes) => format!("class=\"{}\"", classes),
- None => "".to_owned(),
- };
let encoding = match self.encoding {
Some(ref encoding) => format!("enctype=\"{encoding}\"", encoding = encoding),
None => "".to_owned(),
};
format!(
- "\n",
+ "