#![allow(unused_variables)] fn main() { use std::any::Any; fn print_if_string(value: Box) { if let Ok(string) = value.downcast::() { println!("String ({}): {}", string.len(), string); } } let my_string = "Hello World".to_string(); print_if_string(Box::new(my_string)); print_if_string(Box::new(0i8)); }