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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//! This module defines the `process` trait, which is designed to make processing simple
//! structs, like a
use coordinator;
use ScanResult;
use make_default_scan_modules;
use ArmorlibError;
use BinaryObject;
use File;
/// A trait that allows for the object to be run through the ArmorLib system with only a single
/// call to `.process()`. This is a perfectly valid way of passing objects through ArmorLib,
/// however `coordinator::Process` is also available for more granular control.
///
/// # Examples
///
/// ```rust
/// use armorlib::Process;
/// let data: Vec<u8> = vec![]; // empty data for demo
/// let scan_result = data.process().unwrap();
/// ```
/// An empty implementation of Process for `Vec<u8>`. Because `BinaryObject: From<Vec<u8>>` is
/// implemented in the `binary_object` module, no special implementation is necessary here.
/// Provided that `binary_object` is in scope, you can just call `vec.process()`.
///
/// # Examples
///
/// ```rust
/// use armorlib::binary_object::BinaryObject;
/// use armorlib::process::Process;
/// let vec: Vec<u8> = vec![1, 2, 3, 4, 5];
/// let _scan_result = vec.process().unwrap(); // this is a `ScanResult` object
/// ```
// TODO: documentation. How do you create fake demo files to work with?
/// An empty implementation of Process for `BinaryObject`. Because `BinaryObject:
/// From<BinaryObject>>` is implemented in the `binary_object` module, no special implementation
/// is necessary here. Provided that `binary_object` is in scope, you can just call
/// `binary_object.process()`.
///
/// # Examples
///
/// ```rust
/// use armorlib::binary_object::BinaryObject;
/// use armorlib::process::Process;
/// let vec: Vec<u8> = vec![1, 2, 3, 4, 5];
/// let bin_obj = BinaryObject::from(vec);
/// let _scan_result = bin_obj.process().unwrap(); // this is a `ScanResult` object
/// ```