]> git.lizzy.rs Git - rust.git/blob - src/librustc_session/utils.rs
Move NativeLibraryKind to rustc_session
[rust.git] / src / librustc_session / utils.rs
1 // Hack up our own formatting for the duration to make it easier for scripts
2 // to parse (always use the same number of decimal places and the same unit).
3 pub fn duration_to_secs_str(dur: std::time::Duration) -> String {
4     const NANOS_PER_SEC: f64 = 1_000_000_000.0;
5     let secs = dur.as_secs() as f64 +
6                dur.subsec_nanos() as f64 / NANOS_PER_SEC;
7
8     format!("{:.3}", secs)
9 }
10
11 #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
12 pub enum NativeLibraryKind {
13     /// native static library (.a archive)
14     NativeStatic,
15     /// native static library, which doesn't get bundled into .rlibs
16     NativeStaticNobundle,
17     /// macOS-specific
18     NativeFramework,
19     /// Windows dynamic library without import library.
20     NativeRawDylib,
21     /// default way to specify a dynamic library
22     NativeUnknown,
23 }
24
25 rustc_data_structures::impl_stable_hash_via_hash!(NativeLibraryKind);