// Macros must be defined before the modules that use them
cfg_net! { /// Helper macro to execute a system call that returns an `io::Result`. // // Macro must be defined before any modules that uses them.
macro_rules! syscall {
($fn: ident ( $($arg: expr),* $(,)* ), $err_test: path, $err_value: expr) => {{ let res = unsafe { $fn($($arg, )*) }; if $err_test(&res, &$err_value) {
Err(io::Error::last_os_error())
} else {
Ok(res)
}
}};
}
mod net;
pub(crate) mod tcp; pub(crate) mod udp;
pubuse selector::{SelectorInner, SockState};
}
cfg_os_ext! { pub(crate) mod named_pipe;
}
mod waker; pub(crate) use waker::Waker;
cfg_io_source! { use std::io; use std::os::windows::io::RawSocket; use std::pin::Pin; use std::sync::{Arc, Mutex};
impl Drop for InternalState { fn drop(&mutself) { letmut sock_state = self.sock_state.lock().unwrap();
sock_state.mark_delete();
}
}
pubstruct IoSourceState { // This is `None` if the socket has not yet been registered. // // We box the internal state to not increase the size on the stack as the // type might move around a lot.
inner: Option<Box<InternalState>>,
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.