3 ms·
It's a taste. C# allows the more common patterns, but Rust allows much more. For example, Rust allows the equivalent of storing `Span<T>` (called slice in Rust
by afdbcreid 1y ago
It's a taste. C# allows the more common patterns, but Rust allows much more.
For example, Rust allows the equivalent of storing `Span<T>` (called slice in Rust) everywhere (including on the heap, although this is rare).
- Rohansi 1y agoThe restriction in C# comes from its ability to reference stack allocated memory. I'm not familiar with Rust but it probably figures it out based on the lifetime of T.
- Measter 1y agoIt's not the lifetime of T, but the lifetime of whatever is storing T.
- sedatk 1y agoC# has a separate heap storable span equivalent called Memory<T>.