[][src]Struct sdlang::Attribute

pub struct Attribute {
    pub name: String,
    pub value: Value,
}

A value with an associated name, forming a single attribute.

Multiple attributes may be placed on tags.

Conversion functions are providing for parsing and for converting to and from a (String, Value) tuple (useful for collecting a set of attributes into a hash map).

Fields

name: String

The name of the attribute.

value: Value

The associated value.

Methods

impl Attribute[src]

pub fn new(name: String, value: Value) -> Self[src]

Creates a new Attribute.

Trait Implementations

impl PartialEq<Attribute> for Attribute[src]

impl From<(String, Value)> for Attribute[src]

fn from((k, v): (String, Value)) -> Self[src]

Converts from a key-value tuple.

Useful when converting from an iterator of key-value pairs (which may originate from HashMap::iter()).

impl From<Attribute> for (String, Value)[src]

fn from(attr: Attribute) -> Self[src]

Converts into a key-value tuple.

Useful when converting into an iterator of key-value pairs (which may be collected into a HashMap).

impl Display for Attribute[src]

fn fmt(&self, f: &mut Formatter) -> Result[src]

Formats as <name>: <value>.

impl Debug for Attribute[src]

fn fmt(&self, f: &mut Formatter) -> Result[src]

Formats the same way as fmt::Display. Useful for non-excessive debug output.

impl FromStr for Attribute[src]

type Err = Error

The associated error which can be returned from parsing.

fn from_str(s: &str) -> Result<Self>[src]

Parses the text for an Attribute, returning a parse error on failure.

Auto Trait Implementations

impl Send for Attribute

impl Sync for Attribute

Blanket Implementations

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From for T[src]

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

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.