| 96 | #[doc(alias = "cfgetspeed")] |
| 97 | #[inline] |
| 98 | pub fn input_speed(&self) -> u32 { |
| 99 | // On Linux and BSDs, `input_speed` is the arbitrary integer speed. |
| 100 | #[cfg(any(linux_kernel, bsd))] |
| 101 | { |
| 102 | debug_assert!(u32::try_from(self.input_speed).is_ok()); |
| 103 | self.input_speed as u32 |
| 104 | } |
| 105 | |
| 106 | // On illumos, `input_speed` is not present. |
| 107 | #[cfg(any(solarish, all(libc, target_env = "newlib"), target_os = "aix"))] |
| 108 | unsafe { |
| 109 | speed::decode(c::cfgetispeed(crate::utils::as_ptr(self).cast())).unwrap() |
| 110 | } |
| 111 | |
| 112 | // On other platforms, it's the encoded speed. |
| 113 | #[cfg(not(any( |
| 114 | linux_kernel, |
| 115 | bsd, |
| 116 | solarish, |
| 117 | all(libc, target_env = "newlib"), |
| 118 | target_os = "aix" |
| 119 | )))] |
| 120 | { |
| 121 | speed::decode(self.input_speed).unwrap() |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | /// Return the output communication speed. |
| 126 | /// |