macro_rules! setsockopt_impl {
($name:ident, $level:expr, $flag:path, $ty:ty, $setter:ty) => { ... };
}Expand description
Helper for implementing SetSockOpt for a given socket option. See
::sys::socket::SetSockOpt.
This macro aims to help implementing SetSockOpt for different socket options that accept
different kinds of data to be used with setsockopt.
Instead of using this macro directly consider using sockopt_impl!,
especially if the option you are implementing represents a simple type.
ยงArguments
$name:ident: name of the type you want to implementSetSockOptfor.$level:expr: socket layer, or aprotocol level: could be raw sockets (libc::SOL_SOCKET), ip protocol (libc::IPPROTO_IP), tcp protocol (libc::IPPROTO_TCP), and more. Please refer to your system manual for more options. Will be passed as the second argument (level) to thesetsockoptcall.$flag:path: a flag name to set. Some examples:libc::SO_REUSEADDR,libc::TCP_NODELAY,libc::IP_ADD_MEMBERSHIPand others. Will be passed as the third argument (option_name) to thesetsockoptcall.- Type of the value that you are going to set.
- Type that implements the
Settrait for the type from the previous item (likeSetBoolforbool,SetUsizeforusize, etc.).