Re:Learning Parser Combinators with Rust
by tigershark on Friday April 19, 2019 @10:13AM
(#19699767)
So it’s basically like a Span in C# if I understood correctly?
[ Parent
| on HN ]
Re:Learning Parser Combinators with Rust
by steveklabnik on Friday April 19, 2019 @10:16AM
(#19699796)
I am not familiar with the in-memory representation of Slice, but conceptually at least, yes. We call &str a "string slice" and &[T] more generally a "slice".
EDIT: apparently you just edited from Slice to Span, reading https://msdn.microsoft.com/en-us/magazine/mt814808.aspx
> First, Span<T> is a value type containing a ref and a length, defined approximately as follows:
Yep, exactly the same as Span<T> then.
Re:Learning Parser Combinators with Rust
by tigershark on Friday April 19, 2019 @10:28AM
(#19699890)
Sorry, I wrote Slice instead of Span in the original comment... Slice is the method that returns a Span that is the equivalent of this rust concept as far as I can tell.
At some point in the future I’ll need to delve in rust, it’s quite fascinating, but sadly I don’t have much time nowadays :(
Re:Learning Parser Combinators with Rust
by steveklabnik on Friday April 19, 2019 @10:31AM
(#19699917)
It's all good, on both counts! We'll still be around when you find the time :)