guest_emulation_transport/
resolver.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! Resource definitions for the GET client.
5
6use crate::GuestEmulationTransportClient;
7use std::convert::Infallible;
8use vm_resource::CanResolveTo;
9use vm_resource::PlatformResource;
10use vm_resource::ResolveResource;
11use vm_resource::ResourceKind;
12
13/// A resource kind for getting a [`GuestEmulationTransportClient`].
14///
15/// This is primarily used with [`PlatformResource`].
16pub enum GetClientKind {}
17
18impl ResourceKind for GetClientKind {
19    const NAME: &'static str = "get";
20}
21
22impl CanResolveTo<GuestEmulationTransportClient> for GetClientKind {
23    type Input<'a> = ();
24}
25
26impl ResolveResource<GetClientKind, PlatformResource> for GuestEmulationTransportClient {
27    type Output = GuestEmulationTransportClient;
28    type Error = Infallible;
29
30    fn resolve(
31        &self,
32        PlatformResource: PlatformResource,
33        (): (),
34    ) -> Result<Self::Output, Self::Error> {
35        Ok(self.clone())
36    }
37}