#dyn #fat #pointer #thin #ptr-metadata

nightly no-std fat_type

A type which permits thin references to arrays and dynamic types

2 unstable releases

0.2.0 Oct 11, 2022
0.1.0 Jun 17, 2021

#1161 in Rust patterns

Apache-2.0 OR MIT

317 lines


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.


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


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.


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


This document is Copyright (C) 2022 Nathan Sharp.

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

No runtime deps