[−][src]Enum sgf_parse::SgfProp
An SGF Property with identifier and value.
All general properties from the SGF
specification and all go specific properties will
return the approprite enum instance with parsed data. Unrecognized properties, or properties
from other games will return Unknown(identifier, values)
.
See Property Value Types for a list of types recognized by SGF. For parsing purposes the following mappings are used:
Variants
B(Move)
MN(i64)
W(Move)
PL(Color)
C(String)
DM(Double)
GB(Double)
GW(Double)
HO(Double)
N(String)
UC(Double)
V(f64)
BM(Double)
TE(Double)
CA(String)
FF(i64)
GM(i64)
ST(i64)
HA(i64)
KM(f64)
AN(String)
BR(String)
BT(String)
CP(String)
DT(String)
EV(String)
GN(String)
GC(String)
ON(String)
OT(String)
PB(String)
PC(String)
PW(String)
RE(String)
RO(String)
RU(String)
SO(String)
TM(f64)
US(String)
WR(String)
WT(String)
BL(f64)
OB(i64)
OW(i64)
WL(f64)
PM(i64)
Implementations
impl SgfProp
[src]
pub fn new(
identifier: String,
values: Vec<String>
) -> Result<SgfProp, SgfParseError>
[src]
identifier: String,
values: Vec<String>
) -> Result<SgfProp, SgfParseError>
Returns a new property parsed from the provided identifier and values
Examples
use sgf_parse::SgfProp; // SgfProp::B(Point{ x: 2, y: 3 } let prop = SgfProp::new("B".to_string(), vec!["cd".to_string()]); // SgfProp::AB(vec![Point{ x: 2, y: 3 }, Point { x: 3, y: 3 }]) let prop = SgfProp::new("AB".to_string(), vec!["cd".to_string(), "dd".to_string()]); // SgfProp::Unknown("FOO", vec!["Text"]) let prop = SgfProp::new("FOO".to_string(), vec!["Text".to_string()]);
pub fn identifier(&self) -> String
[src]
Returns a the identifier associated with the SgfProp.
Examples
use sgf_parse::SgfProp; // Prints "W" let prop = SgfProp::new("W".to_string(), vec!["de".to_string()]).unwrap(); println!("Identifier: {}", prop.identifier()); // Prints "FOO" let prop = SgfProp::new("FOO".to_string(), vec!["de".to_string()]).unwrap(); println!("Identifier: {}", prop.identifier());
pub fn property_type(&self) -> Option<PropertyType>
[src]
Returns the PropertyType associated with the property.
Examples
use sgf_parse::SgfProp; // Prints "W" let prop = SgfProp::new("W".to_string(), vec!["de".to_string()]).unwrap(); println!("Identifier: {}", prop.identifier()); // Prints "FOO" let prop = SgfProp::new("FOO".to_string(), vec!["de".to_string()]).unwrap(); println!("Identifier: {}", prop.identifier());
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for SgfProp
impl Send for SgfProp
impl Sync for SgfProp
impl Unpin for SgfProp
impl UnwindSafe for SgfProp
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,