[−][src]Struct rubric::submission::Submission
A submission is a bundle of data that represents one student's submission. They will do some sort of work for a lab, then run a rust script that builds some criteria, runs those criteria with some data from the student, and submits a Submission to a central webserver where the instructor can collect the graded submissions.
Fields
time: DateTime<Local>
A local timestamp when the submission was created
grade: i16
Numerical grade for the submission. Each criterion will add to this grade if it passes.
data: TestData
Extra data attached to the submission. Leave it empty if you don't need it
passed: Vec<String>
The criteria (name) that this submission passed
failed: Vec<String>
The citeria (name) that this submission failed
Implementations
impl Submission
[src]
pub fn new() -> Submission
[src]
Creates a new submission.
Example
use rubric::Submission; // You probably want it to be mutable so // you can attach data and change the grade let mut sub = Submission::new(); assert_eq!(sub.grade, 0); assert_eq!(sub.data.len(), 0);
pub fn use_data(&mut self, data: TestData)
[src]
Attaches data to a submission
The data must be a TestData
.
You may want to use the data!
macro to make it
easier to establish your data.
You may be interested in Submission::from_data
.
Example
let data = data! { "key" => "value", "key2" => "value2" }; let mut sub = Submission::new(); sub.use_data(data); assert_eq!(sub.data["key"], "value"); assert_eq!(sub.data["key2"], "value2");
pub fn from_data(data: TestData) -> Self
[src]
Creates a new submission and attaches data to it in one step
Example
let sub = Submission::from_data(data! { "name" => "luke i guess", "id" => "1234" }); assert_eq!(sub.data["id"], "1234");
pub fn pass<C: AsRef<str>>(&mut self, criterion: C)
[src]
Marks a criterion as passed. Provide the name of the criterion.
This struct does not include an actual Criterion
struct in it's passed
and failed
fields, because it's impossible to
serialize a Criterion
. Submission
s must be serializable. Instead, only the
name and message of the criterion are stored on the submission
Example
let mut sub = Submission::new(); sub.pass("Some criterion name"); assert!(sub.passed.contains(&"Some criterion name".to_string()));
pub fn fail<C: AsRef<str>>(&mut self, criterion: C)
[src]
Same as pass
, but adds to the failed
vector
pub fn grade_against(&mut self, rubric: &mut Rubric)
[src]
Tests a submission against a list of criterion
pub fn set_timestamp_format(&mut self, new_format: &str)
[src]
Overrides the default timestamp format.
The default is %Y-%m-%d %a %T %:z
which gives
2001-08-04 Thu 00:34:60 +09:30
This timestamp format is human readable and also sortable in a spreadsheet.
Trait Implementations
impl AsCsv for Submission
[src]
fn as_csv(&self) -> String
[src]
Returns the submission's values in csv format. The TestData
atttached will be
sorted alphabetically by key.
fn filename(&self) -> String
[src]
Returns the filename to use when writing submissions to disk
fn header(&self) -> String
[src]
Returns a header of all the fields, matching the data in as_csv
impl Debug for Submission
[src]
impl<'de> Deserialize<'de> for Submission
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl PartialEq<Submission> for Submission
[src]
fn eq(&self, other: &Submission) -> bool
[src]
fn ne(&self, other: &Submission) -> bool
[src]
impl Serialize for Submission
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralPartialEq for Submission
[src]
Auto Trait Implementations
impl RefUnwindSafe for Submission
impl Send for Submission
impl Sync for Submission
impl Unpin for Submission
impl UnwindSafe for Submission
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T, I> AsResult<T, I> for T where
I: Input,
I: Input,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoCollection<T> for T
fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
A: Array<Item = T>,
fn mapped<U, F, A>(self, f: F) -> SmallVec<A> where
A: Array<Item = U>,
F: FnMut(T) -> U,
A: Array<Item = U>,
F: FnMut(T) -> U,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Typeable for T where
T: Any,
T: Any,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,