pub struct Answer {
pub fraction: i8,
pub text: String,
pub feedback: Option<String>,
pub text_format: TextFormat,
}
Expand description
Answer type struct, which is common for all question types.
Fields§
§fraction: i8
Fraction of the answer, -100-100
text: String
The answer text
feedback: Option<String>
Optional feedback for the answer
text_format: TextFormat
Text format for the answer and feedback, defines the rendering format for Moodle.
Implementations§
Source§impl Answer
impl Answer
Sourcepub fn new(
new_fraction: i8,
new_text: String,
new_feedback: Option<String>,
) -> Self
pub fn new( new_fraction: i8, new_text: String, new_feedback: Option<String>, ) -> Self
Generates a new Answer type struct
§Arguments
new_fraction
- The amount of points answer gives from 0-100new_text
- Text displayed on the answer.new_feedback
- Feedback displayed on the answer can be left empty with None.
Sourcepub fn set_text_format(&mut self, text_format: TextFormat)
pub fn set_text_format(&mut self, text_format: TextFormat)
Sets the text rendering format for the answer and feedback. Default is HTML.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Answer
impl RefUnwindSafe for Answer
impl Send for Answer
impl Sync for Answer
impl Unpin for Answer
impl UnwindSafe for Answer
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