File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -115,3 +115,7 @@ jobs:
115115 run : cargo run --example typed
116116 - name : typed UTF8 Example
117117 run : cargo run --example typed_utf8
118+ - name : platform Example
119+ run : cargo run --example platform
120+ - name : platform UTF8 Example
121+ run : cargo run --example platform_utf8
Original file line number Diff line number Diff line change 1+ use typed_path:: PlatformPath ;
2+
3+ fn main ( ) {
4+ // You can create the path like normal, but it is a distinct encoding from Unix/Windows
5+ let path = PlatformPath :: new ( "some/path" ) ;
6+
7+ // The path will still behave like normal and even report its underlying encoding
8+ assert_eq ! ( path. has_unix_encoding( ) , cfg!( unix) ) ;
9+ assert_eq ! ( path. has_windows_encoding( ) , cfg!( windows) ) ;
10+
11+ // It can still be converted into specific platform paths
12+ let _ = path. with_unix_encoding ( ) ;
13+ let _ = path. with_windows_encoding ( ) ;
14+ }
Original file line number Diff line number Diff line change 1+ use typed_path:: Utf8PlatformPath ;
2+
3+ fn main ( ) {
4+ // You can create the path like normal, but it is a distinct encoding from Unix/Windows
5+ let path = Utf8PlatformPath :: new ( "some/path" ) ;
6+
7+ // The path will still behave like normal and even report its underlying encoding
8+ assert_eq ! ( path. has_unix_encoding( ) , cfg!( unix) ) ;
9+ assert_eq ! ( path. has_windows_encoding( ) , cfg!( windows) ) ;
10+
11+ // It can still be converted into specific platform paths
12+ let _ = path. with_unix_encoding ( ) ;
13+ let _ = path. with_windows_encoding ( ) ;
14+ }
You can’t perform that action at this time.
0 commit comments