Skip to content

Commit 491ccd1

Browse files
committed
Change the return type of volume_serial_number to u32.
Change the return types of `volume_serial_number()` and `number_of_links()` from `u64` to `u32`. This makes it easier to migrate code from manually using the underlying Windows APIs with `dwVolumeSerialNumber` and `nNumberOfLinks`, which are `u32`, to using `winapi_util::file::Information` instead. This also aligns with Rust nightly's [`windows_by_handle`] feature, where the [corresponding types are `u32`]. [`windows_by_handle`]: rust-lang/rust#63010 [corresponding types are `u32`]: https://doc.rust-lang.org/stable/std/os/windows/fs/trait.MetadataExt.html#tymethod.volume_serial_number
1 parent 8f291c9 commit 491ccd1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/file.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ impl Information {
9999
/// Return the serial number of the volume that the file is on.
100100
///
101101
/// This corresponds to `dwVolumeSerialNumber`.
102-
pub fn volume_serial_number(&self) -> u64 {
103-
self.0.dwVolumeSerialNumber as u64
102+
pub fn volume_serial_number(&self) -> u32 {
103+
self.0.dwVolumeSerialNumber
104104
}
105105

106106
/// Return the file size, in bytes.
@@ -113,8 +113,8 @@ impl Information {
113113
/// Return the number of links to this file.
114114
///
115115
/// This corresponds to `nNumberOfLinks`.
116-
pub fn number_of_links(&self) -> u64 {
117-
self.0.nNumberOfLinks as u64
116+
pub fn number_of_links(&self) -> u32 {
117+
self.0.nNumberOfLinks
118118
}
119119

120120
/// Return the index of this file. The index of a file is a purpotedly

0 commit comments

Comments
 (0)