Skip to content

Plan for cleaner seperation of libstd facade and implementation #2

@panicbit

Description

@panicbit

There are 3 key crates in this plan: libstd, abstract_platform, and platform (e.g. platform_unix).

  • libstd links to the abstract_platform and a platform crate. Almost all libstd types wrap around their counterpart in abstract_platform, instancing them via the platform impl.
    This crate needs to make sure to only interact with the platform crate via the abstract_platform types, with the exception of statics and the ext module.
    No assumptions over any of the types provided by platform may be made.
    To allow a smoother transition, this will be implemented completely inside of ::sys at first.

  • abstract_platform provides traits deacribing the required types, functions and constants to be provided by a platform crate. Furthermore it provides almost all types of libstd but generic over the platform (using the aforementioned traits). Statics can't be generic, so they can't be formalized via a trait and thus need to follow an informal contract (probably described in the crate doc).

  • platform provides a platform implementation by implementing the traits and statics from abstract_platform.
    Platform specific extensions may be provided at ::ext via a platform specific contract.
    This crate needs to take care not to export any items except ::Std (which needs to implement abstract_platform::traits::Std), required statics and an optional ext module.
    ::Std must be either an empty struct or an empty enum.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions