rust_releases_io/
document.rs1use std::path::PathBuf;
2
3#[derive(Debug, Eq, PartialEq)]
5pub struct RetrievedDocument {
6 document: Document,
7 retrieval_location: RetrievalLocation,
8}
9
10impl RetrievedDocument {
11 pub fn new(document: Document, retrieval_location: RetrievalLocation) -> Self {
13 Self {
14 document,
15 retrieval_location,
16 }
17 }
18
19 pub fn into_document(self) -> Document {
21 self.document
22 }
23
24 pub fn retrieval_location(&self) -> &RetrievalLocation {
26 &self.retrieval_location
27 }
28}
29
30#[derive(Debug, Eq, PartialEq)]
32pub struct Document {
33 buffer: Vec<u8>,
34}
35
36impl Document {
37 pub fn new(buffer: Vec<u8>) -> Self {
39 Self { buffer }
40 }
41
42 pub fn buffer(&self) -> &[u8] {
44 &self.buffer
45 }
46
47 pub fn into_buffer(self) -> Vec<u8> {
49 self.buffer
50 }
51}
52
53#[derive(Debug, Eq, PartialEq)]
55pub enum RetrievalLocation {
56 RemoteUrl(String),
58 Cache(PathBuf),
60}