File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1022,12 +1022,25 @@ impl FromRawHandle for File {
10221022
10231023impl fmt:: Debug for File {
10241024 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
1025- // FIXME(#24570): add more info here (e.g., mode)
10261025 let mut b = f. debug_struct ( "File" ) ;
10271026 b. field ( "handle" , & self . handle . as_raw_handle ( ) ) ;
10281027 if let Ok ( path) = get_path ( self ) {
10291028 b. field ( "path" , & path) ;
10301029 }
1030+
1031+ if let Ok ( file_attr) = self . file_attr ( ) {
1032+ b. field ( "read" , & true ) ;
1033+ if file_attr. perm ( ) . readonly ( ) {
1034+ b. field ( "write" , & false ) ;
1035+ } else {
1036+ b. field ( "write" , & true ) ;
1037+ }
1038+
1039+ // Getting analogue of file mode (unix) using file attributes
1040+ // See https://learn.microsoft.com/ru-ru/windows/win32/fileio/file-attribute-constants
1041+ b. field ( "attrs" , & file_attr. attributes ) ;
1042+ }
1043+
10311044 b. finish ( )
10321045 }
10331046}
You can’t perform that action at this time.
0 commit comments