use std::ops::Deref;
use std::sync::Arc;
use crate::bus::QueryFailure;
pub struct Snapshot<S> {
inner: Arc<S>,
}
impl<S> Snapshot<S> {
pub fn from_arc(inner: Arc<S>) -> Self {
Snapshot { inner }
}
pub fn get(&self) -> &S {
&self.inner
}
}
impl<S> Clone for Snapshot<S> {
fn clone(&self) -> Self {
Snapshot {
inner: Arc::clone(&self.inner),
}
}
}
impl<S> Deref for Snapshot<S> {
type Target = S;
fn deref(&self) -> &S {
&self.inner
}
}
#[derive(Debug)]
pub struct ServerReply {
pub payload: Vec<u8>,
pub family: &'static str,
pub api_version: &'static str,
}
pub type ServerOutcome = std::result::Result<ServerReply, QueryFailure>;