Macro constmuck::IsCopy [−][src]
macro_rules! IsCopy {
() => { ... };
($T : ty) => { ... };
}
Expand description
Constructs an IsCopy<$T>
,
requires $T:
Pod
for reasons explained in the
bound section.
This has an optional type argument ($T
) that defaults to
infering the type if not passed.
This macro is defined for completeness’ sake,
no function in this crate takes IsCopy
by itself,
always a TypeSize<T, IsCopy<T>, _>
,
which can be constructed with the
TypeSize
macro.
Related: the copying
module
Example
use constmuck::{IsCopy, TypeSize, copying};
const FOO: IsCopy<u32> = IsCopy!();
assert_eq!(copying::copy(&100u32, TypeSize!(u32).with_bounds(FOO)), 100);
// the typical way to call `copying::copy`.
assert_eq!(copying::copy(&100u32, TypeSize!(u32)), 100);
const BAR: IsCopy<[u8; 4]> = IsCopy!([u8; 4]);
let arr = [3, 5, 8, 13];
assert_eq!(copying::copy(&arr, TypeSize!([u8; 4]).with_bounds(BAR)), arr);
// the typical way to call `copying::copy`.
assert_eq!(copying::copy(&arr, TypeSize!([u8; 4])), arr);