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

Method output_speed

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

Source from the content-addressed store, hash-verified

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

Callers 2

tcsetattrFunction · 0.80
fmtMethod · 0.80

Calls 2

decodeFunction · 0.85
as_ptrFunction · 0.85

Tested by

no test coverage detected