Skip to content

Commit 34e9882

Browse files
committed
use std::optional
1 parent e3b871c commit 34e9882

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/inspector/io_agent.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ void IoAgent::Wire(UberDispatcher* dispatcher) {
1414
}
1515

1616
DispatchResponse IoAgent::read(const String& in_handle,
17-
Maybe<int> in_offset,
18-
Maybe<int> in_size,
17+
std::optional<int> in_offset,
18+
std::optional<int> in_size,
1919
String* out_data,
2020
bool* out_eof) {
2121
std::string url = in_handle;
@@ -24,15 +24,15 @@ DispatchResponse IoAgent::read(const String& in_handle,
2424

2525
int offset = 0;
2626
bool offset_was_specified = false;
27-
if (in_offset.isJust()) {
28-
offset = in_offset.fromJust();
27+
if (in_offset.has_value()) {
28+
offset = *in_offset;
2929
offset_was_specified = true;
3030
} else if (offset_map_.find(url) != offset_map_.end()) {
3131
offset = offset_map_[url];
3232
}
3333
int size = 1 << 20;
34-
if (in_size.isJust()) {
35-
size = in_size.fromJust();
34+
if (in_size.has_value()) {
35+
size = *in_size;
3636
}
3737
if (static_cast<std::size_t>(offset) < txt_view.length()) {
3838
std::string_view out_view = txt_view.substr(offset, size);

src/inspector/io_agent.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class IoAgent : public IO::Backend {
1414
: network_resource_manager_(std::move(network_resource_manager)) {}
1515
void Wire(UberDispatcher* dispatcher);
1616
DispatchResponse read(const String& in_handle,
17-
Maybe<int> in_offset,
18-
Maybe<int> in_size,
17+
std::optional<int> in_offset,
18+
std::optional<int> in_size,
1919
String* out_data,
2020
bool* out_eof) override;
2121
DispatchResponse close(const String& in_handle) override;

0 commit comments

Comments
 (0)