Skip to main content

Question

Struct Question 

Source
pub struct Question {
Show 19 fields pub kind: Kind, pub name: String, pub label: Localized, pub hint: Localized, pub guidance_hint: Localized, pub appearance: Option<String>, pub calculation: Option<String>, pub relevant: Option<String>, pub constraint: Option<String>, pub required: Option<String>, pub readonly: Option<String>, pub constraint_message: Localized, pub required_message: Localized, pub parameters: Vec<(String, String)>, pub media: Vec<Media>, pub default: Option<String>, pub choice_filter: Option<String>, pub save_to: Option<String>, pub trigger: Option<String>,
}
Expand description

A single survey question from the survey sheet.

Fields§

§kind: Kind

Resolved type semantics.

§name: String

Node name; becomes the instance element name.

§label: Localized

Label text (single- or multi-language).

§hint: Localized

Hint text (single- or multi-language).

§guidance_hint: Localized

guidance_hint text: a secondary hint rendered via an itext <value form="guidance"> (single- or multi-language).

§appearance: Option<String>

appearance column value, if any.

§calculation: Option<String>

Expression from the calculation column, if any.

§relevant: Option<String>

Expression from the relevant column, if any.

§constraint: Option<String>

Expression from the constraint column, if any.

§required: Option<String>

Raw required column value (e.g. yes or an expression), if any.

§readonly: Option<String>

Raw read_only column value, if any.

§constraint_message: Localized

constraint_message column (single- or multi-language).

§required_message: Localized

required_message column (single- or multi-language).

§parameters: Vec<(String, String)>

Parsed parameters column, as (key, value) pairs.

§media: Vec<Media>

Label media (images/audio/video), possibly per-language.

§default: Option<String>

Default value (default column), placed in the primary instance.

§choice_filter: Option<String>

choice_filter expression for cascading selects, if any.

§save_to: Option<String>

save_to column: the entity property this answer populates, if any.

§trigger: Option<String>

trigger column: names a node whose change drives this question’s calculation via an odk:setvalue action instead of a calculate bind.

Implementations§

Source§

impl Question

Source

pub fn parameter(&self, key: &str) -> Option<&str>

The value of a parameter from the parameters column, if present.

Trait Implementations§

Source§

impl Clone for Question

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Question

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Question

Source§

impl PartialEq for Question

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Question

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.