News for hackers. Stuff that matters.
Re:Pingora, the proxy that connects Cloudflare to the Internet by nicoburns on Friday September 16, 2022 @05:53AM (#32864171)
There is also PathBuf, which would use a string in most languages. And sometimes one may need to work with Vec<u8> or Vec<Char>. And then slice/view variants of all the above.
Re:Pingora, the proxy that connects Cloudflare to the Internet by d3nj4l on Friday September 16, 2022 @09:06AM (#32865564)
Yeah, when Rust beginners (like me!) think "types of string" I think it's more likely to be &str (and its lifetime variants), String and Vec<u8>. I've gotten pretty far as a beginner by sticking to over-copying with just String, but eventually I think I'll have to figure out what works best for perf.
Re:Pingora, the proxy that connects Cloudflare to the Internet by 0x457 on Sunday September 18, 2022 @04:30PM (#32891216)
> There is also PathBuf, which would use a string in most languages.

I feel bad for them. I wanted to fix something in NeoVim's built-in lsp recently and lost all interest because of all the things you have to do to:

- Get parent directory for a path - Create that directory if it exists

Why was I annoyed by that? Well, different OSs use different path separators, in rust this is trivial because `Path` and `PathBuf` are target-specific.

That's not a type of string though, it's a path, the fact that it uses `OsString` underneath is irrelevant.

> Vec<u8> or Vec<Char>

There isn't really anything special to learn about it them, though? I doubt newbie encounter this while learning. Slices are the same thing, you just can't extend it, what is there to learn?

Re:Pingora, the proxy that connects Cloudflare to the Internet by manholio on Friday September 16, 2022 @07:19AM (#32864634)
> And then slice/view variants of all the above.

So all in all, about a dozen kinds of strings.