move writer

This commit is contained in:
Theis Pieter Hollebeek 2024-11-21 11:31:33 +01:00
parent 4f9a671bdc
commit 253b182c45
2 changed files with 5 additions and 1 deletions

View File

@ -58,7 +58,7 @@ auto slige_rpc::RpcServer<Functor>::listen() -> Res<Unit>
} }
auto req = sliger::json::parse_json(message); auto req = sliger::json::parse_json(message);
auto writer = BufferedWriter(client); auto writer = BufferedWriter(client);
this->functor(req, writer); this->functor(req, std::move(writer));
message.clear(); message.clear();
break; break;
} }

View File

@ -63,6 +63,10 @@ public:
: fd(fd) : fd(fd)
{ {
} }
BufferedWriter(const BufferedWriter&) = delete;
BufferedWriter operator=(const BufferedWriter&) = delete;
BufferedWriter(BufferedWriter&&) = delete;
BufferedWriter operator=(BufferedWriter&&) = delete;
~BufferedWriter() { close(fd); } ~BufferedWriter() { close(fd); }
auto flush() -> Res<size_t>; auto flush() -> Res<size_t>;