Enum mango_orm::widgets::output_data::OutputData
source · [−]pub enum OutputData {
Check((bool, Vec<String>, HashMap<String, Widget>, Document)),
Save((bool, Vec<String>, HashMap<String, Widget>)),
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))
Save((bool, Vec<String>, HashMap<String, Widget>))
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) -> Result<String, Box<dyn Error>>
pub fn to_html(&self) -> Result<String, Box<dyn Error>>
Get Html-line
Example:
let user_profile = UserProfile {...};
let output_data = user_profile.check()?;
let output_data = user_profile.save(None, None)?;
println!("{}", output_data.to_html()?);
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
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