| 129 | /// constant value. |
| 130 | #[inline] |
| 131 | pub fn output_speed(&self) -> u32 { |
| 132 | // On Linux and BSDs, `output_speed` is the arbitrary integer speed. |
| 133 | #[cfg(any(linux_kernel, bsd))] |
| 134 | { |
| 135 | debug_assert!(u32::try_from(self.output_speed).is_ok()); |
| 136 | self.output_speed as u32 |
| 137 | } |
| 138 | |
| 139 | // On illumos, `output_speed` is not present. |
| 140 | #[cfg(any(solarish, all(libc, target_env = "newlib"), target_os = "aix"))] |
| 141 | unsafe { |
| 142 | speed::decode(c::cfgetospeed(crate::utils::as_ptr(self).cast())).unwrap() |
| 143 | } |
| 144 | |
| 145 | // On other platforms, it's the encoded speed. |
| 146 | #[cfg(not(any( |
| 147 | linux_kernel, |
| 148 | bsd, |
| 149 | solarish, |
| 150 | all(libc, target_env = "newlib"), |
| 151 | target_os = "aix" |
| 152 | )))] |
| 153 | { |
| 154 | speed::decode(self.output_speed).unwrap() |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | /// Set the input and output communication speeds. |
| 159 | /// |