« first day (2049 days earlier)      last day (1432 days later) » 

7:57 AM
@Shepmaster It does, but that is a different story. There is a reason why it's called nightly and I believe the Rust community has this bad habit / practice of relying on it. If you are a core a developer, or someone closely working with them, or a tester, etc. then sure, use it, that's what it is for. But if you are a library or application developer whose stuff goes into production and other people rely on it then stay away.
@Shepmaster That sounds like an interesting setup, I read others who run both on their CI just to see if any upcoming changes are going to break their code. For me this latter approach could make sense but as I said I would not use it as a production-ready development tool -- because it is not.
@Stargateur Oh, I used the nightly before, several times actually, I'm quite aware of how it works. (Or how nightlies, alphas, betas, dev-snapshots, etc. supposed to work.)
@E4netisheretodownvote That is my average is well when things go very, very well. Wise people say though, it would be better if it would be +195 -778 ;)
@PeterVaro *I read about others who run both versions [...]
 
8:48 AM
How would you efficiently check whether a Path ends with a '/' (ie make the difference between PathBuf::from("/home") and PathBuff::from("/home/") ?
Using to_str (and thus verifying the whole string as UTF8) for this looks overkill
 
@PeterVaro I've had my share of PRs of that nature too. But it's worth mentioning that DICOM-rs is definitely in the growing phase, many parts of the standard are yet to be covered.
Plus, the numbers include tests.
 
 
2 hours later…
10:47 AM
@DenysSéguret I guess it’s also a question of why it matters; I’d expect it not to for most methods.
 
11:48 AM
@Shepmaster I ran into such a situation once. IIRC the rsync command has different behavior depending on whether the trailing / is included. I was writing a backup utility and I had to manually check whether the user-provided path ended with a slash before handing it on to rsync
 
@Shepmaster no because / isn't a component if it's not at the start
 
 
3 hours later…
2:42 PM
@DenysSéguret there is no different between home and home/
 
@Stargateur there are many cases they represent different things
Think autocompletion for example. Or just a user provided entry you must interpret. In one case it's valid only if it's a directory.
 
@DenysSéguret to know if the path is a directory to should use doc.rust-lang.org/std/path/struct.Path.html#method.is_dir
 
You're assuming the file exists
 
well, that why linux have mkdir
 
When the user types /a/b you don't have the same information than if he types /a/b/. In the second case you know it means a directory. And you don't need a filesystem to reason about paths
 
2:46 PM
you should not try to create a file or a directory just with the / at the end
not necessary
 
You don't read my comments, do you ?
It's about paths, not files
 
but for paths a file and a directory is not different
 
that work like that since 1950
if you want the user to be able to create a dir you should do a option
like --dir
or whatever
 
Imagine a user types a and you want to propose completions. You can propose the a directory but also the ab file. If the use typed a/, you can't propose the ab file but you should propose the children of the a directory
 
2:49 PM
well, that obvious ab can't match a/
 
but it can match a
That why I need to make the difference between a and a/
 
I still don't see why, if user type a you propose two choice a/ and ab
 
Right now I must use my own representation to wrap paths
@Stargateur and if the user types a/ ?
 
well path is complete
oh I think I see
 
There are places in broot where I must keep a string instead of a pathbuf, and places where I awkwardly do to_string_lossy().to_string() because I can't directly read the / from the components
 
2:53 PM
mayby std::path is not the right tool in this case
 
you can't really avoid it, especially for file access. So you have a mess of costly conversions as soon as you do complex interactions
 
I'm surprised there's no as_bytes (or AsRef<[u8]>) for Path or OsStr. There must be some catch I'm not thinking of
 
@trentcl there are some private methods
 
@Stargateur but once you get the OsStr you still can't check whether it ends_with "/"
oh you do have as_bytes... but only on Unix
 
2:58 PM
yes
it's utf16 on win
 
sigh fine
 
@DenysSéguret wtf16
 
the Rust standard library has outsmarted me once again
 
9
Q: How can I convert OsStr to &[u8]/Vec<u8> on Windows?

0xMingYangI'm trying to persistent raw OS file names to storage, so I need to get the raw bytes of an OsStr. It seems possible to call as_bytes() on *nix platforms, but that isn't defined on MS Windows. Is there a portable way to convert OsStr to bytes?

lul
 
There are valid reasons for not making the internals more exposed, it's full of trap. But the path and components representation is IMO not ideal
!!afk civ6
 
3:58 PM
URLO told me that pathbuf.push("") adds a trailing /. This is ugly...
 
@DenysSéguret Ew, I agree. Especially since pathbuf.pop() on /a/b/ pops the b
Does ends_with("") distinguish between the two cases?
 
4:50 PM
DICOM-rs v0.2.0 is out. 🎉
 
 
1 hour later…
6:01 PM
Have you ever wondered why we call the second associated type of IntoIterator as IntoIter? Why is it not just Iter? It doesn't make any sense.. (In case one would think that would collide with std::slice::Iter and other similar names.. well, we have this pretty cool feature called namespaces so I don't think so.. The only reason I could think of is the similar spelling between Item and Iter.. but that's still not a good enough reason for me..)
 
@PeterVaro I have feel the same but I don't have strong opinion
 
6:32 PM
@Stargateur What why
Git that out. :((((
 
@E_net4isunsafe haha XD
note that OP consider python as system programming language
@E_net4isunsafe more for you tikv.org/blog/rust-compilation-calamity
 
@Stargateur Meh
 
> TiKV is a relatively large Rust codebase, with 2 million lines of Rust.
 
That one at least knows their carp
 
@Stargateur well, you can write C extensions and pause / ignore the GIL for good.. so you know.. for the price of a single Python function call.. XD XD XD
 
6:38 PM
@PeterVaro well yes you can
I will not call that practical ^^
 
and I would not say anything like that seriously, especially not with 3!!! 'XD' at the end.. would I? ;)
 
Can you please include the full error message in the question? And while you are at it, it's also a good idea to actually read it in full – Rust's error messages are often very helpful. — Sven Marnach 2 mins ago
when sven steal my style you know the question is bad
 
6:57 PM
That OP has shown a trend of subpar questions. If it gets any worse they should be warned that we expect a bit more effort.
Btw, what's with this one?
 
@E_net4isunsafe isn't off topic ?
also wtf compare Rust with javascript runtime
 
Yep, the answers are evidence that it's not focused enough.
Let me see those CVs.
 
I've basically stopped using "needs more focus" because the help text says "includes more than one question"
which is ridiculous but I don't have the energy to fight it
 
@trentcl ah !
@trentcl XD
 
yeah it's annoying. clearly a question like "how to make cool website?" is unfocused despite literally containing only one question
but it's been argued on Meta and that doesn't seem to have had any effect
 
7:10 PM
SO do what they want
as I do
as we do
 
8:07 PM
@trentcl If it makes you feel any better, many people still call it "too broad".
So you should keep using it. If enough "innocent bystanders" complain that their posts with a single question were closed with this reason, then that will probably fuel a change.
 
 
4 hours later…
11:59 PM
@E_net4isunsafe hmm... I approve of this approach
 

« first day (2049 days earlier)      last day (1432 days later) »