MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / input_speed

Method input_speed

src/termios/types.rs:98–123  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

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 ///

Callers 2

tcsetattrFunction · 0.80
fmtMethod · 0.80

Calls 2

decodeFunction · 0.85
as_ptrFunction · 0.85

Tested by

no test coverage detected