Lines Matching full:into
13 /// Implements safe `as` conversion functions from a given type into a series of target types.
17 ($from:ty as { $($into:ty),* }) => {
23 "`] into a [`",
24 ::core::stringify!($into),
42 ::core::stringify!($into),
46 ::core::stringify!($into),
51 pub(crate) const fn [<$from _as_ $into>](value: $from) -> $into {
52 kernel::static_assert!(size_of::<$into>() >= size_of::<$from>());
54 value as $into
68 // A `usize` fits into a `u64` on 32 and 64-bit platforms.
72 // A `usize` fits into a `u32` on 32-bit platforms.
140 /// Counterpart to the [`FromSafeCast`] trait, i.e. this trait is to [`FromSafeCast`] what [`Into`]
153 /// Convert `self` into a `T`. This operation is guaranteed to be lossless.
167 /// Implements lossless conversion of a constant from a larger type into a smaller one.
169 ($from:ty => { $($into:ty),* }) => {
175 "`] constant value into a [`",
176 ::core::stringify!($into),
187 /// // Succeeds because the value of the source fits into the destination's type.
192 ::core::stringify!($into),
196 ::core::stringify!($into),
200 pub(crate) const fn [<$from _into_ $into>]<const N: $from>() -> $into {
202 static_assert!($from::BITS >= $into::BITS);
203 // CAST: we statically enforced above that `$from` is larger than `$into`, so the
205 build_assert!(N >= $into::MIN as $from && N <= $into::MAX as $from);
207 N as $into