#![allow(unused)]
#![feature(unix_socket_abstract)]
use std::os::unix::net::{UnixListener, SocketAddr};
fn main() -> std::io::Result<()> {
let addr = SocketAddr::from_abstract_namespace(b"hidden")?;
let listener = match UnixListener::bind_addr(&addr) {
Ok(sock) => sock,
Err(err) => {
println!("Couldn't bind: {err:?}");
return Err(err);
}
};
Ok(())
}
Errors:
Compiling playground v0.0.1 (/playground)
Finished dev [unoptimized + debuginfo] target(s) in 1.30s
Running `target/debug/playground`
Everything compiles on the playground, but locally I get an error
error[E0599]: no function or associated item named `from_abstract_namespace` found for struct `std::os::unix::net::SocketAddr` in the current scope
--> src/main.rs:6:28
|
6 | let addr = SocketAddr::from_abstract_namespace(b"hidden")?;
| ^^^^^^^^^^^^^^^^^^^^^^^
| |
| function or associated item not found in `std::os::unix::net::SocketAddr`
| help: there is an associated function with a similar name: `from_pathname`
For more information about this error, try `rustc --explain E0599`.
error: could not compile `socket_abstract` due to previous error
Why doesn't my assembly see the standard library?