Skip to main content Skip to main content
Pigweed's logo Pigweed
code_xml
  1. Home
  2. Reference
  3. Rust
  4. pw_kernel
  5. pw_cast
  6. try_cast

try_cast

Macro try_cast 

Source
macro_rules! try_cast {
    ($e:expr => $t:ty) => { ... };
}
Expand description

Attempts to perform a lossless cast.

This macro evaluates to an expression of type Option<$t>. It is similar to [TryInto], but it works in a const context.