@@ 66,13 66,17 @@ impl ResourceDescriptor {
#[derive(Debug, Deserialize, PartialEq, Serialize)]
pub struct Link {
rel: RelOrUri,
+ /// The media type of the target resource.
#[serde(rename = "type")]
pub mime_type: Option<String>,
+ /// The URI pointing to the target resource.
pub href: Option<Uri>,
+ /// Human-readable descriptions of the link relation, keyed by a language tag or "und".
#[serde(default)]
- pub titles: HashMap<String, String>,
+ pub titles: HashMap<String, String>, // TODO: Make Titles type
+ /// Additional information about the link relation, keyed by URIs.
#[serde(default)]
- pub properties: HashMap<Uri, Option<String>>,
+ pub properties: HashMap<Uri, Option<String>>, // TODO: Make Properties type
}
impl Link {
@@ 98,6 102,12 @@ impl Link {
})
}
+ /// Insert a title to the link.
+ pub fn title(mut self, lang: String, title: String) -> Self {
+ self.titles.insert(lang, title);
+ self
+ }
+
/// Insert a property to the link.
pub fn property(mut self, key: Uri, value: Option<String>) -> Self {
self.properties.insert(key, value);