Skip to main content

distrib_node/
program.rs

1// This is free and unencumbered software released into the public domain.
2
3use alloc::{boxed::Box, string::String, vec::Vec};
4use core::error::Error;
5use distrib_common::{Build, Clean, Tool, Utf8PathBuf};
6use std::process::Command;
7
8pub const NODE_COMMAND: &str = "node";
9
10#[derive(Clone, Debug, Eq, Hash, PartialEq)]
11pub struct NodeProgram(Utf8PathBuf);
12
13impl Default for NodeProgram {
14    fn default() -> Self {
15        Self(NODE_COMMAND.into())
16    }
17}
18
19impl From<Utf8PathBuf> for NodeProgram {
20    fn from(input: Utf8PathBuf) -> Self {
21        Self(input)
22    }
23}
24
25impl<T> From<&T> for NodeProgram
26where
27    T: Clone + Into<Self>,
28{
29    fn from(t: &T) -> Self {
30        t.clone().into()
31    }
32}
33
34impl From<NodeProgram> for Command {
35    fn from(input: NodeProgram) -> Self {
36        Command::new(input.0)
37    }
38}
39
40impl NodeProgram {}