Portable way to check if a file is hidden?

Firstly, thanks for considering my question all!

Question #1: is the following function a reasonable way to see if a file is visible in nix (MacOS or Linux)?

#[cfg(unix)]
fn not_hidden(file: &DirEntry) -> bool {
    use std::os::unix::ffi::OsStrExt;

    file.file_name()
        .as_os_str()
        .as_bytes()[0] != b'.'
}

Question #2: How is this done in windows?

Windows stores it in an attribute. However, the meaning of hidden on Windows vs Unix is somewhat different. For example, .cargo is hidden on Unix but not on Windows, even though it does the same thing.

Looks like for Windows, it would look like this:

const FILE_ATTRIBUTE_HIDDEN: u32 = 0x00000002;
file.metadata()?.file_attributes() & FILE_ATTRIBUTE_HIDDEN != 0

Edit: it would be == 0 for not_hidden but it's probably wise for this function to be called hidden to avoid mistakes.