Skip to content

Add runnable examples for path-based and descriptor-based file I/O #377

Closed

Description

@LunaStev

Tracked by #375.

Problem

Current file APIs are easy to misuse. fs_read_all accepts a path, destination pointer, and capacity, while io_read accepts a file descriptor. Existing examples do not make that boundary obvious.

Scope

Add small runnable examples and Wave corpus fixtures for:

  • Opening and closing a file with std::fs::file.
  • Reading a path into a caller-owned byte array with fs_read_all.
  • Reading an already-open descriptor with std::io::fd::io_read.
  • Handling negative return values.
  • Reporting the number of bytes read without treating it as a string length.

Use only current APIs. API renaming belongs to #375 and its design follow-ups.

Completion criteria

  • Every example compiles with the current compiler and installed std layout.
  • At least one fixture executes on supported hosted Linux CI.
  • Buffer capacity and returned byte count are checked.
  • Examples do not import private transitive symbols.
  • Documentation states that fs_read_all does not allocate or return str.

Activity

  1. added
    documentation
    good first issue
    needs testing
    on Aug 27, 2026
  2. Saket7002 commented on Aug 27, 2026

    @Saket7002
    Contributor

    I'd like to work on this issue. I'll first look through the existing file I/O examples and add the requested runnable examples and fixtures while keeping the current APIs unchanged.

  3. LunaStev commented on Aug 27, 2026

    @LunaStev
    MemberAuthor

    I'd like to work on this issue. I'll first look through the existing file I/O examples and add the requested runnable examples and fixtures while keeping the current APIs unchanged.

    Thanks! I've assigned this issue to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

documentationgood first issueneeds testing

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions