1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use super::{Command, Response};
use {Adapter, CommandType, ObjectId, Session, SessionError};
pub fn get_opaque<A: Adapter>(
session: &mut Session<A>,
object_id: ObjectId,
) -> Result<Vec<u8>, SessionError> {
session
.send_command(GetOpaqueCommand { object_id })
.map(|response| response.0)
}
#[derive(Serialize, Deserialize, Debug)]
pub(crate) struct GetOpaqueCommand {
pub object_id: ObjectId,
}
impl Command for GetOpaqueCommand {
type ResponseType = GetOpaqueResponse;
}
#[derive(Serialize, Deserialize, Debug)]
pub(crate) struct GetOpaqueResponse(pub(crate) Vec<u8>);
impl Response for GetOpaqueResponse {
const COMMAND_TYPE: CommandType = CommandType::GetOpaqueObject;
}