agent_hub_runtime/core/preview/
execution.rs1use super::runtime::BrowserProfile;
3use serde::Serialize;
4#[derive(Clone, Copy, Serialize)]
5#[serde(rename_all = "snake_case")]
6pub enum Renderer {
8 Client,
9 Server,
10}
11#[derive(Clone, Copy, Serialize)]
12#[serde(rename_all = "snake_case")]
13pub enum Network {
15 ClientDefault,
16 ServerDefault,
17 Proxy,
18}
19#[derive(Clone, Copy, Serialize)]
20pub struct Execution {
22 pub render: Renderer,
23 pub network: Network,
24}
25impl Execution {
26 pub fn from_profile(profile: &BrowserProfile) -> Self {
28 Self {
29 render: if profile.endpoint.is_some() {
30 Renderer::Server
31 } else {
32 Renderer::Client
33 },
34 network: if profile.proxy.is_some() {
35 Network::Proxy
36 } else if profile.endpoint.is_some() {
37 Network::ServerDefault
38 } else {
39 Network::ClientDefault
40 },
41 }
42 }
43}
44
45#[cfg(test)]
46mod tests;