Skip to content

Commit

Permalink
pw_sys_io: Doxygenify ReadBytes()
Browse files Browse the repository at this point in the history
Change-Id: I1c5b7eb70a84e3a98ac45b2ab2884915ec0a2e84
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/154192
Reviewed-by: Kayce Basques <kayce@google.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Kayce Basques <kayce@google.com>
  • Loading branch information
Kayce Basques authored and CQ Bot Account committed Jul 7, 2023
1 parent ee39b08 commit fb0e327
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
1 change: 1 addition & 0 deletions pw_sys_io/docs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ API reference
.. doxygenfunction:: pw::sys_io::TryReadByte(std::byte* dest)
.. doxygenfunction:: pw::sys_io::WriteByte(std::byte b)
.. doxygenfunction:: pw::sys_io::WriteLine(const std::string_view& s)
.. doxygenfunction:: pw::sys_io::ReadBytes(ByteSpan dest)

Dependencies
============
Expand Down
26 changes: 14 additions & 12 deletions pw_sys_io/public/pw_sys_io/sys_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,20 @@ Status WriteByte(std::byte b);
/// returned as part of the `StatusWithSize`.
StatusWithSize WriteLine(const std::string_view& s);

// Fill a byte span from the sys io backend using ReadByte().
// Implemented by: Facade
//
// This function is implemented by this facade and simply uses ReadByte() to
// read enough bytes to fill the destination span. If there's an error reading a
// byte, the read is aborted and the contents of the destination span are
// undefined. This function blocks until either an error occurs, or all bytes
// are successfully read from the backend's ReadByte() implementation.
//
// Return status is OkStatus() if the destination span was successfully
// filled. In all cases, the number of bytes successuflly read to the
// destination span are returned as part of the StatusWithSize.
/// Fills a byte span from the `pw_sys_io` backend using `ReadByte()`.
///
/// @pre This function must be implemented by the `pw_sys_io` facade.
///
/// This function is implemented by the facade and simply uses `ReadByte()` to
/// read enough bytes to fill the destination span. If there's an error reading
/// a byte, the read is aborted and the contents of the destination span are
/// undefined. This function blocks until either an error occurs or all bytes
/// are successfully read from the backend's `ReadByte()` implementation.
///
/// @returns
/// * @pw_status{OK} if the destination span was successfully filled. In all
/// cases, the number of bytes successuflly read to the destination span are
/// returned as part of the `StatusWithSize`.
StatusWithSize ReadBytes(ByteSpan dest);

// Write span of bytes out the sys io backend using WriteByte().
Expand Down

0 comments on commit fb0e327

Please sign in to comment.