extern crate zakform;
-use zakform::TField;
-
-use zakform::filters;
+use zakform::{form, fields, filters, fields::TField};
use std::collections::HashMap;
s.push_str(r#"<form method="post" action="/">"#);
- let mut f = zakform::Form::new();
+ let mut f = zakform::form::Form::new();
- let mut fi = zakform::FieldText::new("text");
- f.add_field(zakform::TFields::TFieldText(fi));
+ let mut fi = zakform::fields::FieldText::new("text");
+ f.add_field(zakform::form::TFields::TFieldText(fi));
- let mut fi = zakform::FieldRadio::new("radio");
- fi.add_option(zakform::FOption{ value: String::from("F"), label: String::from("Female") });
- fi.add_option(zakform::FOption{ value: String::from("M"), label: String::from("Male") });
+ let mut fi = zakform::fields::FieldRadio::new("radio");
+ fi.add_option(zakform::fields::FOption{ value: String::from("F"), label: String::from("Female") });
+ fi.add_option(zakform::fields::FOption{ value: String::from("M"), label: String::from("Male") });
let single = fi.render_single(1);
- f.add_field(zakform::TFields::TFieldRadio(fi));
+ f.add_field(zakform::form::TFields::TFieldRadio(fi));
let fs = f.fields();
for fi in fs {
match fi {
- zakform::TFields::TFieldText(fi) => { s.push_str(fi.render().as_str()); },
- zakform::TFields::TFieldRadio(fi) => { s.push_str(fi.render().as_str()); },
+ zakform::form::TFields::TFieldText(fi) => { s.push_str(fi.render().as_str()); },
+ zakform::form::TFields::TFieldRadio(fi) => { s.push_str(fi.render().as_str()); },
}
}