build_script/
cargo_rustc_link_lib.rs1#[derive(Debug, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
4pub enum Kind {
5 DynamicLibrary,
7
8 Static,
10
11 Framework,
13}
14
15impl Kind {
16 pub const DYNAMIC_LIBRARY: &'static str = "dylib";
18
19 pub const STATIC: &'static str = "static";
21
22 pub const FRAMEWORK: &'static str = "framework";
24}
25
26impl From<Kind> for &'static str {
27 fn from(kind: Kind) -> Self {
28 match kind {
29 Kind::DynamicLibrary => Kind::DYNAMIC_LIBRARY,
30 Kind::Static => Kind::STATIC,
31 Kind::Framework => Kind::FRAMEWORK,
32 }
33 }
34}
35
36impl From<Kind> for String {
37 fn from(kind: Kind) -> Self {
38 let kind: &str = kind.into();
39 kind.into()
40 }
41}
42
43#[cfg(test)]
44mod tests {
45 use super::Kind;
46
47 #[test]
48 fn test_into_string() {
49 let kind: String = Kind::DynamicLibrary.into();
50 assert_eq!(kind, Kind::DYNAMIC_LIBRARY);
51 let kind: String = Kind::Static.into();
52 assert_eq!(kind, Kind::STATIC);
53 let kind: String = Kind::Framework.into();
54 assert_eq!(kind, Kind::FRAMEWORK)
55 }
56}