summaryrefslogtreecommitdiffstats
path: root/src/schema/value.rs
diff options
context:
space:
mode:
authorPaul Masurel <paul.masurel@gmail.com>2016-09-20 00:43:52 +0900
committerPaul Masurel <paul.masurel@gmail.com>2016-09-20 00:43:52 +0900
commit17715fe84ca64413ece90c24612c165abfcb4342 (patch)
treed5055cc3eb9f95eb11472eec6ec824180398ede9 /src/schema/value.rs
parent49e5114413788d4050e287d61cc42445654b13fc (diff)
Added documentation
Diffstat (limited to 'src/schema/value.rs')
-rw-r--r--src/schema/value.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/schema/value.rs b/src/schema/value.rs
index 3549347..36f21bc 100644
--- a/src/schema/value.rs
+++ b/src/schema/value.rs
@@ -4,13 +4,21 @@ use std::io;
use std::io::Write;
use std::io::Read;
+/// Value represents the value of a any field.
+/// It is an enum over all over all of the possible field type.
#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, RustcEncodable, RustcDecodable)]
pub enum Value {
+ /// The str type is used for any text information.
Str(String),
+ /// Unsigned 32-bits Integer `u32`
U32(u32),
}
impl Value {
+ /// Returns the text value, provided the value is of the `Str` type.
+ ///
+ /// # Panics
+ /// If the value is not of type `Str`
pub fn text(&self) -> &str {
match *self {
Value::Str(ref text) => {
@@ -22,6 +30,10 @@ impl Value {
}
}
+ /// Returns the u32-value, provided the value is of the `U32` type.
+ ///
+ /// # Panics
+ /// If the value is not of type `U32`
pub fn u32_value(&self) -> u32 {
match *self {
Value::U32(ref value) => {