pub struct DataForm {
pub type_: DataFormType,
pub title: Option<String>,
pub instructions: Option<String>,
pub fields: Vec<Field>,
}
Expand description
This is a form to be sent to another entity for filling.
Fields§
§type_: DataFormType
The type of this form, telling the other party which action to execute.
title: Option<String>
The title of this form.
instructions: Option<String>
The instructions given with this form.
fields: Vec<Field>
A list of fields comprising this form.
Implementations§
Source§impl DataForm
impl DataForm
Sourcepub fn new(type_: DataFormType, form_type: &str, fields: Vec<Field>) -> DataForm
pub fn new(type_: DataFormType, form_type: &str, fields: Vec<Field>) -> DataForm
Create a new DataForm.
Sourcepub fn form_type(&self) -> Option<&str>
pub fn form_type(&self) -> Option<&str>
Return the value of the FORM_TYPE
field, if any.
An easy accessor for the FORM_TYPE of this form, see XEP-0068 for more information.
Sourcepub fn set_form_type(&mut self, ty: String) -> &mut Field
pub fn set_form_type(&mut self, ty: String) -> &mut Field
Create or modify the FORM_TYPE
field.
If the form has no FORM_TYPE
field, this function creates a new
field and inserts it at the beginning of the field list. Otherwise, it
returns a mutable reference to the existing field.
§Panics
If the type of the form is DataFormType::Cancel
, this function
panics. Such forms should not have any fields and thus no form type.
Trait Implementations§
Source§impl From<ServerInfo> for DataForm
impl From<ServerInfo> for DataForm
Source§fn from(server_info: ServerInfo) -> DataForm
fn from(server_info: ServerInfo) -> DataForm
Converts to this type from the input type.
Source§impl TryFrom<DataForm> for ServerInfo
impl TryFrom<DataForm> for ServerInfo
impl StructuralPartialEq for DataForm
Auto Trait Implementations§
impl Freeze for DataForm
impl RefUnwindSafe for DataForm
impl Send for DataForm
impl Sync for DataForm
impl Unpin for DataForm
impl UnwindSafe for DataForm
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more