mod utils {
pub fn do_something() { /* ... */ }
}
let result = utils::do_something();
struct MyStruct;
impl MyStruct {
fn new() -> Self {
MyStruct
}
}
let instance = MyStruct::new();
trait MyTrait {
type Output;
const VALUE: u32 = 42;
}
impl MyTrait for i32 {
type Output = String;
}
let value = <i32 as MyTrait>::VALUE;
fn test3<T: AsRef<str>>(s: T) -> T {
s
}
let result = test3::<&str>("hello");