[][src]Module activitystreams::primitives

Types defined as 'primitives' are used as building-blocks for ActivityStreams objects.

For example, an Object may have a summary field, which is defined as a range of xsd:string and rdf:langString. As code, this is represented as an enum that either contains an XsdString or an RdfLangString.

use activitystreams::primitives::{RdfLangString, XsdString};

/// Define a terminating enum for the Summary field in Object Properties
///
/// In this case, terminating means it does not contain child elements.
pub enum ObjectPropertiesSummaryTermEnum {
    XsdString(XsdString),
    RdfLangString(RdfLangString),
}

/// Since summary isn't functional, we can either have a single string, or multiple strings.
pub enum ObjectPropertiesSummaryEnum {
    Term(ObjectPropertiesSummaryTermEnum),
    Array(Vec<ObjectPropertiesSummaryTermEnum>),
}

/// Define an excerpt from the ObjectProperties struct
pub struct ObjectProperties {
    // ...

    /// Since summary isn't a required field, it's stored as an option
    summary: Option<ObjectPropertiesSummaryEnum>,

    // ...
}

Structs

MimeMediaType

A MIME Media Type consists of a top-level type and a subtype, which is further structured into trees.

MimeMediaTypeError

The error type produced when a MimeMediaType cannot be parsed

RdfLangString

The rdf.langString type extends xs.string, and represents a language tagged string in RDF.

XsdAnyUri

The type xsd:anyURI represents a Uniform Resource Identifier (URI) reference.

XsdAnyUriError

The error type produced when an XsdAnyUri cannot be parsed

XsdDateTime

The type xsd:dateTime represents a specific date and time in the format CCYY-MM-DDThh:mm:ss.sss, which is a concatenation of the date and time forms, separated by a literal letter "T".

XsdDateTimeError

The error type produced when an XsdDateTime cannot be parsed

XsdDuration

The type xsd:duration represents a duration of time expressed as a number of years, months, days, hours, minutes, and seconds.

XsdDurationError

The error type produced when an XsdDuration cannot be parsed

XsdFloat

The type xsd:float represents an IEEE single-precision 32-bit floating-point number.

XsdFloatError

The error type produced when an XsdFloat cannot be parsed

XsdNonNegativeFloat

The type xsd:float represents an IEEE single-precision 32-bit floating-point number.

XsdNonNegativeFloatError

The error type produced when an XsdNonNegativeFloat cannot be parsed

XsdNonNegativeInteger

The type xsd:nonNegativeInteger represents an arbitrarily large non-negative integer.

XsdNonNegativeIntegerError

The error type produced when an XsdNonNegativeInteger cannot be parsed

XsdString

A string type that conforms to the xsd:string specification.

Enums

Length

A list of units of length that represent valid units for certain ActivityStreams objects