26#include <fruit/fruit.h>
39template <
auto Fn,
typename R,
typename...
Args>
44 :
args_(std::forward_as_tuple(args...)) {}
48 if constexpr (std::is_same_v<R, Result<std::vector<MonitorCommand>>>) {
50 }
else if constexpr (std::is_same_v<R, std::vector<MonitorCommand>>) {
52 }
else if constexpr (std::is_same_v<R, Result<MonitorCommand>>) {
54 }
else if constexpr (std::is_same_v<R, MonitorCommand>) {
56 }
else if constexpr (std::is_same_v<
62 }
else if constexpr (std::is_same_v<R, std::optional<MonitorCommand>>) {
63 auto cmd = std::apply(Fn,
args_);
68 static_assert(CommandAlwaysFalse<R>,
"Unexpected AutoCmd return type");
73 std::string
Name()
const override {
74 static constexpr auto kName = ValueName<Fn>();
75 return std::string(kName);
91template <auto Fn1,
typename Fn2>
94template <
auto Fn,
typename R,
typename...
Args>
98 static fruit::Component<
99 fruit::Required<typename std::remove_reference_t<Args>...>,
Type>
101 auto cmd = fruit::createComponent()
102 .template addMultibinding<CommandSource, Type>()
103 .template addMultibinding<SetupFeature, Type>();
104 constexpr bool uses_kernel_log_pipe =
106 std::remove_reference_t<Args>> ||
108 if constexpr (uses_kernel_log_pipe) {
109 return cmd.template addMultibinding<KernelLogPipeConsumer, Type>();
Definition: expected.h:86
Definition: command_source.h:38
Definition: auto_cmd.h:41
std::tuple< Args... > args_
Definition: auto_cmd.h:87
std::string Name() const override
Definition: auto_cmd.h:73
std::vector< MonitorCommand > commands_
Definition: auto_cmd.h:88
Result< std::vector< MonitorCommand > > Commands() override
Definition: auto_cmd.h:82
std::unordered_set< SetupFeature * > Dependencies() const override
Definition: auto_cmd.h:78
Definition: kernel_log_pipe_provider.h:32
Definition: kernel_log_pipe_provider.h:25
virtual Result< void > ResultSetup()=0
#define CF_EXPECT(...)
Definition: result.h:414
Definition: alloc_utils.cpp:23
std::unordered_set< SetupFeature * > SetupFeatureDeps(const std::tuple< Args... > &args)
Definition: feature.h:174
constexpr std::false_type CommandAlwaysFalse
Definition: auto_cmd.h:37
std::vector< std::string_view > Args
Definition: incremental.h:28
static fruit::Component< fruit::Required< typename std::remove_reference_t< Args >... >, Type > Component()
Definition: auto_cmd.h:100
Definition: auto_cmd.h:92