#thin #pointers #fat #dyn #ptr-metadata

nightly no-std fat_type

A type which permits thin references to arrays and dynamic types

3 releases (breaking)

0.3.0 Jan 23, 2023
0.2.0 Oct 11, 2022
0.1.0 Jun 17, 2021

#279 in FFI

Download history 4/week @ 2024-02-16 16/week @ 2024-02-23 3/week @ 2024-03-01 1/week @ 2024-03-08 40/week @ 2024-03-29 14/week @ 2024-04-05

54 downloads per month

Apache-2.0 OR MIT

26KB
329 lines

fat_type

fat_type provides the type Fat<T, U>, which combines a value of type U with the metadata needed to construct references to it as a T.

Because the metadata is stored with the value instead of in references, Fat<T> is Thin. This property is mainly useful in niche foreign-function-interface use-cases or in memory-constrained environments. As such, this library is no_std.

In particular, the author has found this crate useful in passing around Rust closure types as userdata pointers in several C-language FFI projects.

Documentation

Inline rustdoc documentation is available. A mirror of this documentation is available at https://docs.rs/fat_type.

Contributing

fat_type is developed at GitLab.

This crate is rigorously tested with Miri and maintains full compliance with strict pointer provenance.

Reasonable performance, correctness, documentation, and ease-of-use contributions are always welcome. Bug reports are accepted through GitLab, but feature requests are not.

Pull Requests

Please ensure pull requests match the existing coding style and are formatted with rustfmt.

Spelling and grammatical errors are considered bugs, so please use spell-checking facilities prior to submitting a contribution.

Contribution Agreement

By contributing, you grant all contributors a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, relicense, sublicense, and distribute your contributions.

Additionally, you affirm that you are legally entitled to grant such license and that your contributions are not and will not become patent-encumbered. In the event that you discover that such affirmation was made in error, you agree to post notice of such error in a conspicuous place (such as a GitLab Issue) within three days.

License

fat_type is licensed under the terms of the Apache License, Version 2.0 or the MIT License.

Copyright

This document is Copyright (C) 2022 Nathan Sharp.

Permission is granted to reproduce this document, in any form, free of charge.

No runtime deps