Skip to content

#![no-std] implementation #50

@LGFae

Description

@LGFae

These crates seem sufficiently simple to warrant a #![no-std] implementation. This would allow them to be used in binaries that do not link std. People may do that mostly on memory-constrained environments, such as embedded devices. Another reason to do that is simply trying to generate smaller binaries in general.

In any case, I believe it would make the crates more flexible, for very little cost.

For fontconfig-sys literally all it takes is changing the imports from std::os::raw to core::ffi. That's the recommended import anyway, in fact. For fontconfig, it is almost just changing the imports. The only problem is a PathBuf usage that will have to become a String in #[no_std] environments.

I have already implemented all these changes, and can open a PR if the maintainers of this repository are willing to maintain this. I believe it would be very easy. In fact, the diff is very small:

➜ g d --stat
  fontconfig-sys/src/lib.rs |  6 ++++--
  fontconfig/Cargo.toml     |  2 ++
  fontconfig/src/lib.rs     | 46 ++++++++++++++++++++++++++++++++--------------
  3 files changed, 38 insertions(+), 16 deletions(-)

EDIT: actually, upon more careful examination, fontconfig-sys depends on dlib which automatically generates stuff which imports std::mem::transmute;. So this is currently impossible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions