Crate fat_type[][src]

Expand description

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.

Other Members

The Mut<T> type is a safe wrapper around &mut Fat<T>.

The Erased<T> type represents a value with a partially erased type.

The FatRef and FatMut traits allow multiple dispach on &Fat, &mut Fat, and Mut. You should not need to import or implement these traits.

See Also

Signifiant additional documentation is provided on the Fat type.

License

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

Development

fat_type is developed at GitLab.

Structs

Erased

A value with a partially erased type.

Fat

A type which combines a value with the metadata used to construct fat references to it.

Mut

A thin mutable reference to a Fat<T>.

Traits

FatMut

A marker trait indicating a type which can be transmuted into a mutable reference to a Fat<T, U>.

FatRef

A marker trait indicating a type which can be transmuted into an immutable reference to a Fat<T, U>.

Functions

container_of_inner_mut

Obtains a mutable reference to the Fat<T, U> containing the specified sized referent, which may be erased.

container_of_inner_ref

Obtains an immutable reference to the Fat<T, U> containing the specified sized referent, which may be erased.

container_of_mut

Obtains a safe mutable reference to the Fat<T> containing the specified unsized referent.

container_of_ref

Obtains an immutable reference to the Fat<T> containing the specified unsized referent.

convert_mut

Obtains a mutable reference by respecifying the type of the sized referent, which may be erased.

convert_ref

Obtains an immutable reference by respecifying the type of the sized referent, which may be erased.

erase_mut

Obtains a safe thin mutable reference by erasing the type of the sized referent.

erase_ref

Obtains a thin immutable reference by erasing the type of the sized referent.

get_inner_mut

Obtains a mutable reference to the sized referent.

get_inner_ref

Obtains an immutable reference to the sized referent.

get_layout

Returns the un-erased allocation Layout of the specified value.

get_metadata

Obtains the metadata used to construct references to the unsized referent.

get_mut

Obtains a mutable reference to the unsized referent.

get_ref

Obtains an immutable reference to the unsized referent.