apiarchivesouvertesrust/
haldoc.rs

1use std::fmt;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Serialize, Deserialize, Debug)]
5pub struct HALDoc {
6    
7    docid: i64,
8    label_s: Option<String>,
9    uri_s: Option<String>
10}
11
12impl HALDoc {
13
14    pub fn new(
15        docid: i64,
16        label_s: Option<String>,
17        uri_s: Option<String>
18    ) -> HALDoc {
19        HALDoc {
20            docid,
21            label_s,
22            uri_s
23        }
24    }
25
26    pub fn docid(&self) -> i64 {
27        self.docid
28    }
29
30    pub fn label_s(&self) -> Option<String> {
31        self.label_s.clone()
32    }
33
34    pub fn uri_s(&self) -> Option<String> {
35        self.uri_s.clone()
36    }
37}
38
39impl fmt::Display for HALDoc {
40    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
41        write!(f, "{:?}", self)
42    }
43}