1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use crate::data::{get_version_specific_file, PROTOCOL_FILE};
use crate::models::version::Version;
use crate::{DataError, DataResult};
use std::sync::Arc;
pub struct Protocol {
version: Arc<Version>,
}
impl Protocol {
pub fn new(version: Arc<Version>) -> Self {
Self { version }
}
pub fn get_protocol(&self) -> DataResult<crate::models::protocol::Protocol> {
let content = get_version_specific_file(&self.version, PROTOCOL_FILE)?;
serde_json::from_str(&content).map_err(DataError::from)
}
}