25#include "fruit/fruit.h"
38template <
auto Fn,
typename R,
typename...
Args>
43 :
args_(std::forward_as_tuple(args...)) {}
47 if constexpr (std::is_same_v<R, Result<std::vector<MonitorCommand>>>) {
49 }
else if constexpr (std::is_same_v<R, std::vector<MonitorCommand>>) {
51 }
else if constexpr (std::is_same_v<R, Result<MonitorCommand>>) {
53 }
else if constexpr (std::is_same_v<R, MonitorCommand>) {
55 }
else if constexpr (std::is_same_v<
61 }
else if constexpr (std::is_same_v<R, std::optional<MonitorCommand>>) {
62 auto cmd = std::apply(Fn,
args_);
67 static_assert(CommandAlwaysFalse<R>,
"Unexpected AutoCmd return type");
72 std::string
Name()
const override {
73 static constexpr auto kName = ValueName<Fn>();
74 return std::string(
kName);
90template <auto Fn1,
typename Fn2>
93template <
auto Fn,
typename R,
typename...
Args>
97 static fruit::Component<
98 fruit::Required<typename std::remove_reference_t<Args>...>,
Type>
100 auto cmd = fruit::createComponent()
101 .template addMultibinding<CommandSource, Type>()
102 .template addMultibinding<SetupFeature, Type>();
103 constexpr bool uses_kernel_log_pipe =
105 std::remove_reference_t<Args>> ||
107 if constexpr (uses_kernel_log_pipe) {
108 return cmd.template addMultibinding<KernelLogPipeConsumer, Type>();
Definition: command_source.h:37
Definition: auto_cmd.h:40
std::tuple< Args... > args_
Definition: auto_cmd.h:86
std::string Name() const override
Definition: auto_cmd.h:72
std::vector< MonitorCommand > commands_
Definition: auto_cmd.h:87
Result< std::vector< MonitorCommand > > Commands() override
Definition: auto_cmd.h:81
std::unordered_set< SetupFeature * > Dependencies() const override
Definition: auto_cmd.h:77
Definition: kernel_log_pipe_provider.h:32
Definition: kernel_log_pipe_provider.h:25
virtual Result< void > ResultSetup()=0
#define CF_EXPECT(...)
Definition: expect.h:149
@ INJECT
Definition: f2fs_fs.h:443
Definition: alloc_driver.h:20
static constexpr std::string_view kName
Definition: efi_loader.cc:30
std::unordered_set< SetupFeature * > SetupFeatureDeps(const std::tuple< Args... > &args)
Definition: feature.h:175
tl::expected< T, StackTraceError > Result
Definition: result_type.h:30
constexpr std::false_type CommandAlwaysFalse
Definition: auto_cmd.h:36
std::vector< std::string_view > Args
Definition: incremental.h:28
#define R(x, n)
Definition: sha512.c:86
static fruit::Component< fruit::Required< typename std::remove_reference_t< Args >... >, Type > Component()
Definition: auto_cmd.h:99
Definition: auto_cmd.h:91