ErrorKind::Unsupported
RustERRORNotableI/O
Operation not supported
Quick Answer
Check platform compatibility; use cfg! guards for platform-specific code.
What this means
The operation is not supported on this platform or for this type of I/O object.
Why it happens
- 1Calling seek() on a non-seekable stream (stdin, network socket)
- 2Using a Unix-only API on Windows
Fix
Guard platform-specific ops
Guard platform-specific ops
#[cfg(unix)]
fn set_unix_socket_opts(s: &std::net::TcpStream) {
use std::os::unix::io::AsRawFd;
// unix-only operations
}Why this works
cfg attributes prevent unsupported code from compiling on other platforms.
Code examples
Triggerrust
use std::io::Seek; stdin().seek(std::io::SeekFrom::Start(0))?; // Unsupported
Same error in other languages
Sources
Official documentation ↗
Rust std::io
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev