~kmaasrud/pimalaya-webfinger

dfa97cb8449085332c8f539c20396c57e21c5310 — Knut Magnus Aasrud 8 months ago 743ff52
docs: public API work
1 files changed, 12 insertions(+), 2 deletions(-)

M src/lib.rs
M src/lib.rs => src/lib.rs +12 -2
@@ 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);