]> git.proxmox.com Git - rustc.git/blame - src/libstd/os/android/fs.rs
New upstream version 1.41.1+dfsg1
[rustc.git] / src / libstd / os / android / fs.rs
CommitLineData
7453a54e
SL
1#![stable(feature = "metadata_ext", since = "1.1.0")]
2
532ac7d7
XL
3use crate::fs::Metadata;
4use crate::sys_common::AsInner;
7453a54e
SL
5
6#[allow(deprecated)]
532ac7d7 7use crate::os::android::raw;
7453a54e 8
83c7162d
XL
9/// OS-specific extensions to [`fs::Metadata`].
10///
11/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
7453a54e
SL
12#[stable(feature = "metadata_ext", since = "1.1.0")]
13pub trait MetadataExt {
14 /// Gain a reference to the underlying `stat` structure which contains
15 /// the raw information returned by the OS.
16 ///
17 /// The contents of the returned `stat` are **not** consistent across
18 /// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
19 /// cross-Unix abstractions contained within the raw stat.
20 #[stable(feature = "metadata_ext", since = "1.1.0")]
60c5eb7d
XL
21 #[rustc_deprecated(
22 since = "1.8.0",
23 reason = "deprecated in favor of the accessor \
24 methods of this trait"
25 )]
7453a54e
SL
26 #[allow(deprecated)]
27 fn as_raw_stat(&self) -> &raw::stat;
28
29 #[stable(feature = "metadata_ext2", since = "1.8.0")]
30 fn st_dev(&self) -> u64;
31 #[stable(feature = "metadata_ext2", since = "1.8.0")]
32 fn st_ino(&self) -> u64;
33 #[stable(feature = "metadata_ext2", since = "1.8.0")]
34 fn st_mode(&self) -> u32;
35 #[stable(feature = "metadata_ext2", since = "1.8.0")]
36 fn st_nlink(&self) -> u64;
37 #[stable(feature = "metadata_ext2", since = "1.8.0")]
38 fn st_uid(&self) -> u32;
39 #[stable(feature = "metadata_ext2", since = "1.8.0")]
40 fn st_gid(&self) -> u32;
41 #[stable(feature = "metadata_ext2", since = "1.8.0")]
42 fn st_rdev(&self) -> u64;
43 #[stable(feature = "metadata_ext2", since = "1.8.0")]
44 fn st_size(&self) -> u64;
45 #[stable(feature = "metadata_ext2", since = "1.8.0")]
46 fn st_atime(&self) -> i64;
47 #[stable(feature = "metadata_ext2", since = "1.8.0")]
48 fn st_atime_nsec(&self) -> i64;
49 #[stable(feature = "metadata_ext2", since = "1.8.0")]
50 fn st_mtime(&self) -> i64;
51 #[stable(feature = "metadata_ext2", since = "1.8.0")]
52 fn st_mtime_nsec(&self) -> i64;
53 #[stable(feature = "metadata_ext2", since = "1.8.0")]
54 fn st_ctime(&self) -> i64;
55 #[stable(feature = "metadata_ext2", since = "1.8.0")]
56 fn st_ctime_nsec(&self) -> i64;
57 #[stable(feature = "metadata_ext2", since = "1.8.0")]
58 fn st_blksize(&self) -> u64;
59 #[stable(feature = "metadata_ext2", since = "1.8.0")]
60 fn st_blocks(&self) -> u64;
61}
62
63#[stable(feature = "metadata_ext", since = "1.1.0")]
64impl MetadataExt for Metadata {
65 #[allow(deprecated)]
66 fn as_raw_stat(&self) -> &raw::stat {
60c5eb7d 67 unsafe { &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat) }
7453a54e
SL
68 }
69 fn st_dev(&self) -> u64 {
70 self.as_inner().as_inner().st_dev as u64
71 }
72 fn st_ino(&self) -> u64 {
73 self.as_inner().as_inner().st_ino as u64
74 }
75 fn st_mode(&self) -> u32 {
76 self.as_inner().as_inner().st_mode as u32
77 }
78 fn st_nlink(&self) -> u64 {
79 self.as_inner().as_inner().st_nlink as u64
80 }
81 fn st_uid(&self) -> u32 {
82 self.as_inner().as_inner().st_uid as u32
83 }
84 fn st_gid(&self) -> u32 {
85 self.as_inner().as_inner().st_gid as u32
86 }
87 fn st_rdev(&self) -> u64 {
88 self.as_inner().as_inner().st_rdev as u64
89 }
90 fn st_size(&self) -> u64 {
91 self.as_inner().as_inner().st_size as u64
92 }
93 fn st_atime(&self) -> i64 {
94 self.as_inner().as_inner().st_atime as i64
95 }
96 fn st_atime_nsec(&self) -> i64 {
97 self.as_inner().as_inner().st_atime_nsec as i64
98 }
99 fn st_mtime(&self) -> i64 {
100 self.as_inner().as_inner().st_mtime as i64
101 }
102 fn st_mtime_nsec(&self) -> i64 {
103 self.as_inner().as_inner().st_mtime_nsec as i64
104 }
105 fn st_ctime(&self) -> i64 {
106 self.as_inner().as_inner().st_ctime as i64
107 }
108 fn st_ctime_nsec(&self) -> i64 {
109 self.as_inner().as_inner().st_ctime_nsec as i64
110 }
111 fn st_blksize(&self) -> u64 {
112 self.as_inner().as_inner().st_blksize as u64
113 }
114 fn st_blocks(&self) -> u64 {
115 self.as_inner().as_inner().st_blocks as u64
116 }
117}