Skip to content

Redesign std::fs as a user-facing file API #380

Description

@LunaStev

Tracked by #375.

Problem

std::fs::file currently exposes wrapper names such as fs_open and fs_close while read-all operations still require caller-managed buffers. This is a useful low-level foundation but is not yet a clear user-facing filesystem API.

Scope

Define the portable std::fs surface separately from std::sys::fs and std::io::fd.

Consider:

  • Names that do not repeat the fs module namespace unnecessarily.
  • Explicit names for path-based and descriptor-based operations.
  • read_into and read_to_end style distinctions instead of ambiguous read_all naming.
  • File metadata, directory, rename, copy, and removal operations.
  • Buffer ownership and allocation contracts.
  • Integer error behavior until runtime variants can be lowered.
  • A future migration path to Result-based APIs without requiring it in this issue.

Completion criteria

  • Proposed names and signatures are documented before implementation.
  • Every operation identifies whether it consumes a path or descriptor.
  • Portable APIs do not leak platform constants.
  • Raw operations remain available through std::sys or std::io.
  • Migration and compatibility impact is stated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionIssues that require a technical or community discussion.enhancementA request for a new feature or improvement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions