Dot Dot DirEntry as an entry returned by read_dir

How to create DirEntry? I am building a filemanager and I need dot dot entry to be included in a list of entries returned by std::fs::read_dir.
Or perhaps there is a different better way to do it?
Thank you

You can't create your own DirEntry, but you can make your own type that DirEntry can be converted into and use that.

@alice Hi and thanks for the reply. But this still leaves me with the problem that first I have to have a valid DirEntry

Do you need to pass this DirEntry to some external API? If not, you can simply create your type in two different ways - one is using DirEntry, other is not.

@Cerber-Ursi
Yes, it makes sense. Thanks

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.