ublk-cpp v0.1
A ublk library for std::execution.
Loading...
Searching...
No Matches
query.hpp
Go to the documentation of this file.
1
5
6#pragma once
7
9#include "ublk/ublk_cmd.h"
10#include <condy.hpp>
11#include <utility>
12
13namespace ublk {
14
20 template <typename Env>
21 requires requires(const Env &env) {
22 env.query(std::declval<fetch_dev_info_t>());
23 }
24 constexpr const ublksrv_ctrl_dev_info *
25 operator()(const Env &env) const noexcept {
26 return env.query(fetch_dev_info_t{});
27 }
28
29 template <typename Env>
30 requires(!requires(const Env &env) {
31 env.query(std::declval<fetch_dev_info_t>());
32 })
33 constexpr const ublksrv_ctrl_dev_info *
34 operator()(const Env &) const noexcept {
35 return nullptr;
36 }
37
38 [[nodiscard]]
39 static consteval bool query(detail::ex::forwarding_query_t) noexcept {
40 return true;
41 }
42};
43
46
47} // namespace ublk
The std::execution backend namespace used by ublk-cpp.
The main namespace of the ublk-cpp library.
Definition ublk.hpp:21
constexpr fetch_dev_info_t fetch_dev_info
Query object instance of fetch_dev_info_t.
Definition query.hpp:45
Environment query for the cached ublk device info. Returns nullptr if the environment doesn't provide...
Definition query.hpp:19