[−][src]Enum boxcars::HeaderProp
All the interesting data are stored as properties in the header, properties such as:
- When and who scored a goal
- Player stats (goals, assists, score, etc).
- Date and level played on
A property can be a number, string, or a more complex object such as an array containing additional properties.
Variants
Bool(bool)
Float(f32)
Int(i32)
Name(String)
QWord(u64)
Str(String)
Methods
impl HeaderProp
[src]
pub fn as_array(&self) -> Option<&Vec<Vec<(String, HeaderProp)>>>
[src]
If the HeaderProp
is an array of properties, returns the array
let v = HeaderProp::Array(vec![ vec![("abc".to_string(), HeaderProp::Byte)] ]); assert_eq!(v.as_array().unwrap().len(), 1); assert_eq!(v.as_array().unwrap()[0][0].1.as_array(), None);
pub fn as_bool(&self) -> Option<bool>
[src]
If the HeaderProp
is a boolean, returns the value
let v = HeaderProp::Bool(true); let b = HeaderProp::Byte; assert_eq!(v.as_bool(), Some(true)); assert_eq!(b.as_bool(), None);
pub fn as_float(&self) -> Option<f32>
[src]
If the HeaderProp
is a float, returns the value
let v = HeaderProp::Float(2.50); let b = HeaderProp::Byte; assert_eq!(v.as_float(), Some(2.50)); assert_eq!(b.as_float(), None);
pub fn as_u64(&self) -> Option<u64>
[src]
If the HeaderProp
is a QWord, returns the value
let v = HeaderProp::QWord(250); let b = HeaderProp::Byte; assert_eq!(v.as_u64(), Some(250)); assert_eq!(b.as_u64(), None);
pub fn as_i32(&self) -> Option<i32>
[src]
If the HeaderProp
is an int, returns the value
let v = HeaderProp::Int(-250); let b = HeaderProp::Byte; assert_eq!(v.as_i32(), Some(-250)); assert_eq!(b.as_i32(), None);
pub fn as_string(&self) -> Option<&str>
[src]
If the HeaderProp
is an string, returns the value
let v = HeaderProp::Name("abc".to_string()); let x = HeaderProp::Str("def".to_string()); let b = HeaderProp::Byte; assert_eq!(v.as_string(), Some("abc")); assert_eq!(x.as_string(), Some("def")); assert_eq!(b.as_i32(), None);
pub fn is_byte(&self) -> bool
[src]
Returns if the HeaderProp
is a byte
let v = HeaderProp::Name("abc".to_string()); let b = HeaderProp::Byte; assert_eq!(v.is_byte(), false); assert_eq!(b.is_byte(), true);
Trait Implementations
impl Clone for HeaderProp
[src]
fn clone(&self) -> HeaderProp
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl PartialEq<HeaderProp> for HeaderProp
[src]
fn eq(&self, other: &HeaderProp) -> bool
[src]
fn ne(&self, other: &HeaderProp) -> bool
[src]
impl Debug for HeaderProp
[src]
impl StructuralPartialEq for HeaderProp
[src]
impl Serialize for HeaderProp
[src]
By default serde will generate a serialization method that writes out the enum as well as the
enum value. Since header values are self describing in JSON, we do not need to serialize the
enum type. This is slightly lossy as in the serialized format it will be ambiguous if a value
is a Name
or Str
, as well as Byte
, Float
, Int
, or QWord
.
Auto Trait Implementations
impl Send for HeaderProp
impl Sync for HeaderProp
impl Unpin for HeaderProp
impl UnwindSafe for HeaderProp
impl RefUnwindSafe for HeaderProp
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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> 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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,