Struct SgfNode

Source
pub struct SgfNode {
    pub children: Vec<SgfNode>,
    /* private fields */
}
Expand description

SGF node with children. It means that a node also represents game tree. Access the field ‘children’ directly to traverse in its tree. To access SGF properties of the node, use various accessors below.

Fields§

§children: Vec<SgfNode>

Implementations§

Source§

impl SgfNode

Source

pub fn new(properties: HashMap<String, Vec<String>>) -> SgfNode

Constructor. Returns an SgfNode with given propertes. Properties should be stored in a HashMap in String name and a vector of String value.

Source

pub fn leaf_mut(&mut self) -> &mut SgfNode

Returns a mutable reference of a leaf node in main line This is for the parser.

Source

pub fn iter(&self) -> Iter<'_, String, Vec<String>>

Returns an iterator of its properties.

Source

pub fn get_point(&self, id: &str) -> Result<SgfPoint, SgfError>

Returns a Result of id’s value as SgfPoint.

Source

pub fn set_point(&mut self, id: &str, value: SgfPoint) -> &mut Self

Sets an SgfpPoint value to property id.

Source

pub fn get_number(&self, id: &str) -> Result<SgfNumber, SgfError>

Returns a Result of id’s value as SgfNumber.

Source

pub fn set_number(&mut self, id: &str, value: SgfNumber) -> &mut Self

Sets an SgfpNumber value to property id.

Source

pub fn get_points(&self, id: &str) -> Result<Vec<SgfPoint>, SgfError>

Returns a Result of id’s value as a vector of SgfPoint.

Source

pub fn set_points(&mut self, id: &str, value: Vec<SgfPoint>) -> &mut Self

Sets an SgfPoint vector to property id.

Source

pub fn get_color(&self, id: &str) -> Result<SgfColor, SgfError>

Returns a Result of id’s value as SgfColor.

Source

pub fn set_color(&mut self, id: &str, value: SgfColor) -> &mut Self

Sets an SgfColor to property id.

Source

pub fn get_double(&self, id: &str) -> Result<SgfDouble, SgfError>

Returns a Result of id’s value as SgfDouble.

Source

pub fn set_double(&mut self, id: &str, value: SgfDouble) -> &mut Self

Sets an SgfDouble to property id.

Source

pub fn get_text(&self, id: &str) -> Result<SgfText, SgfError>

Returns a Result of id’s value as SgfText.

Source

pub fn set_text(&mut self, id: &str, value: String) -> &mut Self

Sets an SgfText to property id.

Source

pub fn get_simple_text(&self, id: &str) -> Result<SgfSimpleText, SgfError>

Returns a Result of id’s value as SgfSimpleText.

Source

pub fn set_simple_text(&mut self, id: &str, value: String) -> &mut Self

Sets an SgfSimpleText to property id.

Source

pub fn get_real(&self, id: &str) -> Result<SgfReal, SgfError>

Returns a Result of id’s value as SgfReal.

Source

pub fn set_real(&mut self, id: &str, value: SgfReal) -> &mut Self

Sets an SgfReal to property id.

Source

pub fn get_point_point( &self, id: &str, ) -> Result<(SgfPoint, SgfPoint), SgfError>

Returns a Result of id’s value as Compose of SgfPoints.

Source

pub fn set_point_point( &mut self, id: &str, value: (SgfPoint, SgfPoint), ) -> &mut Self

Sets a compose of SgfPoints to property id.

Source

pub fn get_point_simple_text( &self, id: &str, ) -> Result<(SgfPoint, SgfSimpleText), SgfError>

Returns a Result of id’s value as Compose of SgfPoint and SgfSimpleText.

Source

pub fn set_point_simple_text( &mut self, id: &str, value: (SgfPoint, SgfSimpleText), ) -> &mut Self

Sets a compose of SgfPoint and SgfSimpleText to property id.

Source

pub fn get_simple_text_simple_text( &self, id: &str, ) -> Result<(SgfSimpleText, SgfSimpleText), SgfError>

Returns a Result of id’s value as Compose of SgfSimpleTexts.

Source

pub fn set_simple_text_simple_text( &mut self, id: &str, value: (SgfSimpleText, SgfSimpleText), ) -> &mut Self

Sets a compose of SgfSimpleTexts to property id.

Source

pub fn get_number_number( &self, id: &str, ) -> Result<(SgfNumber, SgfNumber), SgfError>

Returns a Result of id’s value as Compose of SgfNumbers.

Source

pub fn set_number_number( &mut self, id: &str, value: (SgfNumber, SgfNumber), ) -> &mut Self

Sets a compose of SgfNumbers to property id.

Source

pub fn get_number_simple_text( &self, id: &str, ) -> Result<(SgfNumber, SgfSimpleText), SgfError>

Returns a Result of id’s value as Compose of SgfNumber and SgfSimpleText.

Source

pub fn set_number_simple_text( &mut self, id: &str, value: (SgfNumber, SgfSimpleText), ) -> &mut Self

Sets a compose of SgfNumber and SgfSimpleText to property id.

Trait Implementations§

Source§

impl Debug for SgfNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for SgfNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.