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
//! # Forester HTTP
//! The library provides a contract to implement a remote action alongside with the
//! API to the Forester instance of http server.
//! It is used to get access to the blackboard and to trace events.
//!
//! The library composes three main parts:
//! * `ForesterRemoteAction` - the contract for the remote action that is expected by the Forester instance
//! * `ForesterHttpApi` - the api to Forester instance of http server
//! * `ForesterHttpClient` - the client to the Forester instance of http server
//!
//! Client uses api to get access to the blackboard and to trace events.
//! Under the hood it uses reqwest(blocking) to send requests to the Forester instance.
//! If the library is willing to use another client it can use only api.
//!
use ;
use Value;
/// The result that the node returns
/// It can be Success, Failure or Running
/// The Failure contains the error message
/// The Running means that the node is still running
/// and it will be executed on the next tick
/// The request that is sent from the Forester instance
/// It has the current tick and the arguments in the action from tree
/// The argument that is sent from the Forester instance
/// Describes the contract for the remote action that is expected by the Forester instance
/// The remote action is a remote implementation of the action node in the tree.
///
/// Therefore the implementation of the remote action should be integrated to the http api
/// that is provided on the other side.
///
/// # Example
/// Having the following b-tree:
/// ```f-tree
///
/// root main sequence {
/// remote_action(1,2,3)
/// }
///
/// impl remote_action(a:num, b:num, c:num);
///
/// ```
///
/// Register the action in the Forester instance:
/// ```pseudocode
///
/// fn build_forester(mut fb: ForesterBuilder){
/// ...
/// let action = RemoteHttpAction::new("http://localhost:10000/remote_action/".to_string());
/// fb.register_remote_action("remote_action", action);
/// ...
/// }
///
/// ```
/// Thus, now we need to implement
/// the remote action in the http api: `http://localhost:10000/remote_action/`
/// that will be called by the Forester instance.
///