Enum mango_orm::widgets::output_data::OutputData
source · [−]pub enum OutputData {
Check((bool, Vec<String>, HashMap<String, Widget>, Document, String, String)),
Save((bool, Vec<String>, HashMap<String, Widget>, String, String)),
Delete((bool, String)),
Stub,
}
Expand description
Helper methods for converting output data (use in the paladins.rs module).
Variants
Check((bool, Vec<String>, HashMap<String, Widget>, Document, String, String))
Save((bool, Vec<String>, HashMap<String, Widget>, String, String))
Delete((bool, String))
Stub
Implementations
sourceimpl OutputData
impl OutputData
sourcepub fn hash(&self) -> Result<String, Box<dyn Error>>
pub fn hash(&self) -> Result<String, Box<dyn Error>>
Example:
let user_profile = UserProfile {...};
let output_data = user_profile.check()?;
let output_data = user_profile.save(None, None)?;
println!("{}", output_data.hash()?);
sourcepub fn object_id(&self) -> Result<ObjectId, Box<dyn Error>>
pub fn object_id(&self) -> Result<ObjectId, Box<dyn Error>>
Get MongoDB ID from hash-line
Example:
let user_profile = UserProfile {...};
let output_data = user_profile.check()?;
let output_data = user_profile.save(None, None)?;
println!("{:?}", output_data.object_id()?);
sourcepub fn to_wig(&self) -> Result<HashMap<String, Widget>, Box<dyn Error>>
pub fn to_wig(&self) -> Result<HashMap<String, Widget>, Box<dyn Error>>
Get Map of Widgets ( Wig - Widgets )
Example:
let user_profile = UserProfile {...};
let output_data = user_profile.check()?;
let output_data = user_profile.save(None, None)?;
println!("{:?}", output_data.to_wig()?);
sourcepub fn to_json(&self) -> Result<String, Box<dyn Error>>
pub fn to_json(&self) -> Result<String, Box<dyn Error>>
Get Json-line
Example:
let user_profile = UserProfile {...};
let output_data = user_profile.check()?;
let output_data = user_profile.save(None, None)?;
println!("{}", output_data.to_json()?);
sourcepub fn to_html(
&self,
action: Option<&str>,
method: Option<HttpMethod>,
enctype: Option<Enctype>
) -> Result<String, Box<dyn Error>>
pub fn to_html(
&self,
action: Option<&str>,
method: Option<HttpMethod>,
enctype: Option<Enctype>
) -> Result<String, Box<dyn Error>>
Get Html-code
Example:
let user_profile = UserProfile {...};
let output_data = user_profile.check()?;
let output_data = user_profile.save(None, None)?;
//
println!("{}", output_data.to_html(None, None, None)?);
// OR
println!("{}", output_data.to_html(Some("/login"), Some(HttpMethod::POST), Some(Enctype::Multipart))?);
sourcepub fn to_json_for_admin(&self) -> Result<String, Box<dyn Error>>
pub fn to_json_for_admin(&self) -> Result<String, Box<dyn Error>>
Json-line for admin panel. ( converts a widget map to a list, in the order of the Model fields )
Example:
let user_profile = UserProfile {...};
let output_data = user_profile.save(None, None)?;
println!("{}", output_data.to_json_for_admin()?);
sourcepub fn is_valid(&self) -> Result<bool, Box<dyn Error>>
pub fn is_valid(&self) -> Result<bool, Box<dyn Error>>
Get validation status (boolean)
Example:
let user_profile = UserProfile {...};
let output_data = user_profile.check()?;
let output_data = user_profile.save(None, None)?;
let output_data = user_profile.delete()?;
assert!(result.is_valid()?);
sourcepub fn to_doc(&self) -> Result<Document, Box<dyn Error>>
pub fn to_doc(&self) -> Result<Document, Box<dyn Error>>
Get Document
Example:
let user_profile = UserProfile {...};
let output_data = user_profile.check()?;
println!("{:?}", user_profile.to_doc()?);
sourcepub fn print_err(&self) -> Result<(), Box<dyn Error>>
pub fn print_err(&self) -> Result<(), Box<dyn Error>>
Example:
let user_profile = UserProfile {...};
let output_data = user_profile.check()?;
let output_data = user_profile.save(None, None)?;
println!("{}", output_data.print_err()?);
sourcepub fn err_msg(&self) -> Result<String, Box<dyn Error>>
pub fn err_msg(&self) -> Result<String, Box<dyn Error>>
A description of the error if the document was not deleted. (Main use for admin panel.)
Example:
let user_profile = UserProfile {...};
user_profile.save(None, None)?;
let output_data = user_profile.delete()?;
println!("{}", output_data.err_msg()?);
Trait Implementations
sourceimpl Debug for OutputData
impl Debug for OutputData
sourceimpl HtmlControls for OutputData
impl HtmlControls for OutputData
sourcefn output_data_to_html(
&self,
action: Option<&str>,
method: Option<HttpMethod>,
enctype: Option<Enctype>
) -> Result<String, Box<dyn Error>>
fn output_data_to_html(
&self,
action: Option<&str>,
method: Option<HttpMethod>,
enctype: Option<Enctype>
) -> Result<String, Box<dyn Error>>
This is an intermediate method for the to_html() method.
sourcefn generate_html(
url_action: Option<&str>,
http_method: Option<HttpMethod>,
enctype: Option<Enctype>,
service_name: &str,
model_name: &str,
fields_name: &Vec<String>,
map_widgets: &HashMap<String, Widget>
) -> Result<String, Box<dyn Error>>
fn generate_html(
url_action: Option<&str>,
http_method: Option<HttpMethod>,
enctype: Option<Enctype>,
service_name: &str,
model_name: &str,
fields_name: &Vec<String>,
map_widgets: &HashMap<String, Widget>
) -> Result<String, Box<dyn Error>>
Rendering HTML-controls code for Form. ( If necessary, customize the code generation yourself using html and css from Bootstrap, Material Design, etc. ) Read more
Auto Trait Implementations
impl RefUnwindSafe for OutputData
impl Send for OutputData
impl Sync for OutputData
impl Unpin for OutputData
impl UnwindSafe for OutputData
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more