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
36
37
38
39
40
41
42
43
44
45
46
mod algorithm;
pub(crate) mod commands;
pub use self::algorithm::Algorithm;
use crate::ssh;
#[derive(Debug)]
pub enum Template {
Ssh(ssh::Template),
}
impl Template {
pub fn algorithm(&self) -> Algorithm {
match self {
Template::Ssh(_) => Algorithm::Ssh,
}
}
pub fn ssh(&self) -> Option<&ssh::Template> {
match self {
Template::Ssh(ssh) => Some(ssh),
}
}
}
impl From<ssh::Template> for Template {
fn from(template: ssh::Template) -> Template {
Template::Ssh(template)
}
}
impl AsRef<[u8]> for Template {
fn as_ref(&self) -> &[u8] {
match self {
Template::Ssh(ssh) => ssh.as_ref(),
}
}
}