Where is data stored in Rust generic functions?

⚓ Rust    📅 2026-04-06    👤 surdeus    👁️ 1      

surdeus

Hello everyone

I'm learning Rust and trying to understand generics.
For example:

fn print_value<T>(value: T) {
    println!("{:?}", value);
}

Where is value stored in memory when the function is called? On the stack, heap, or does it depend on the type?

2 posts - 2 participants

Read full topic

🏷️ Rust_feed