* Extract at most the length of the span bytes from the packet into the span. * @param destination The span to write the bytes to. * @return The number of bytes that were actually read. */
| 401 | * @return The number of bytes that were actually read. |
| 402 | */ |
| 403 | size_t Packet::Recv_bytes(std::span<uint8_t> destination) |
| 404 | { |
| 405 | auto transfer_to_span = [&destination](std::span<const uint8_t> source) { |
| 406 | auto to_copy = source.subspan(0, destination.size()); |
| 407 | std::ranges::copy(to_copy, destination.begin()); |
| 408 | return to_copy.size(); |
| 409 | }; |
| 410 | |
| 411 | return this->TransferOut(transfer_to_span); |
| 412 | } |
| 413 | |
| 414 | /** |
| 415 | * Reads characters (bytes) from the packet until it finds a '\0', or reaches a |
no test coverage detected