[][src]Struct rs_tiled_json::property::Property

pub struct Property {
    pub name: String,
    pub value: PropertyValue,
}

The structure defining all properties and how to use them.

Fields

name: Stringvalue: PropertyValue

Methods

impl Property[src]

pub fn name(&self) -> &String[src]

Get the name of the property. Returns a simple string.

pub fn type_as_string(&self) -> &'static str[src]

Get the type of the property as a string slice.

pub fn get_pvalue(&self) -> &PropertyValue[src]

Get a reference to the underlying PropertyValue enum should you wish to match on it manually.

Since we should know what the property type is by name, there are better methods of obtaining the appropriate data. See get_string(), get_int(), get_float(), etc...

pub fn get_string(&self) -> Option<&String>[src]

Provides the string data if this proprty is a string, returns Option::None otherwise.

pub fn get_int(&self) -> Option<i32>[src]

Provides the integer data if this property is an integer, or Option::None.

pub fn get_float(&self) -> Option<f64>[src]

Provides the float data if this property is an float, or Option::None.

pub fn get_bool(&self) -> Option<bool>[src]

Provides the boolean data if this property is a boolean, or Option::None.

pub fn get_color(&self) -> Option<Color>[src]

Provides the Color object if this property describes a color, or Option::None.

pub fn get_file(&self) -> Option<&String>[src]

Provides the filename if this property describes a file, or Option::None.

Trait Implementations

impl Clone for Property[src]

impl Debug for Property[src]

impl<'de> Deserialize<'de> for Property[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.