blob: 377970461e962bc93c4ef5f6eb1242bed3627183 (
plain) (
blame)
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
|
/*
* This source code is released into the public domain.
*/
module;
#include <expected>
#include <string>
import nihil;
import nihil.ucl;
export module liblfvm:serialize;
import :context;
import :vm_config;
namespace lfvm {
/*
* Serialize a vm_config to a UCL string.
*/
export [[nodiscard]] auto serialize(vm_config const &)
-> std::expected<std::string, nihil::error>;
/*
* Deserialize a UCL string into a vm.
*/
export [[nodiscard]] auto deserialize(std::string_view)
-> std::expected<vm_config, nihil::error>;
/*
* Load a VM from disk.
*/
export [[nodiscard]] auto vm_load(context const &, std::string_view name)
-> std::expected<vm_config, nihil::error>;
/*
* Save a new VM to disk based on a config.
*/
export [[nodiscard]] auto vm_create(context const &, vm_config const &)
-> std::expected<void, nihil::error>;
/*
* Save an existing VM to disk.
*/
export [[nodiscard]] auto vm_save(context const &, vm_config const &)
-> std::expected<void, nihil::error>;
/*
* List existing VMs.
*/
export [[nodiscard]] auto vm_list(context const &)
-> std::expected<std::vector<std::string>, nihil::error>;
} // namespace lfvm
|