~kmaasrud/pimalaya-webfinger

8941993154f5c63b7715873b6e9a7c2a359d0e65 — Knut Magnus Aasrud 11 months ago 54e36cf
feat: add ResourceDescriptor type
1 files changed, 12 insertions(+), 12 deletions(-)

M src/lib.rs
M src/lib.rs => src/lib.rs +12 -12
@@ 1,15 1,24 @@
//! This is a WebFinger implementation

mod uri;

use serde::{Deserialize, Serialize};
use std::collections::HashMap;

pub fn add(left: usize, right: usize) -> usize {
    left + right
}
pub use uri::Uri;

#[derive(Debug, Deserialize, PartialEq, Serialize)]
pub struct ResourceDescriptor {
    subject: String,
    #[serde(default)]
    aliases: Vec<String>,
    #[serde(default)]
    properties: HashMap<Uri, Option<String>>,
    #[serde(default)]
    links: Vec<Link>,
}

#[derive(Debug, Deserialize, PartialEq, Serialize)]
pub struct Link {
    rel: Uri, // or registered relation
    mime_type: Option<String>,


@@ 21,12 30,3 @@ pub struct Link {
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn it_works() {
        let result = add(2, 2);
        assert_eq!(result, 4);
    }
}