pub struct Broadcast(/* private fields */);
Expand description
socket option to permit sending of broadcast messages.
Implements the SOL_SOCKET/SO_BROADCAST socket option.
§Examples
Setting the option:
use asyncio::*;
use asyncio::ip::*;
use asyncio::socket_base::Broadcast;
let ctx = &IoContext::new().unwrap();
let soc = UdpSocket::new(ctx, Udp::v4()).unwrap();
soc.set_option(Broadcast::new(true)).unwrap();
Getting the option:
use asyncio::*;
use asyncio::ip::*;
use asyncio::socket_base::Broadcast;
let ctx = &IoContext::new().unwrap();
let soc = UdpSocket::new(ctx, Udp::v4()).unwrap();
let opt: Broadcast = soc.get_option().unwrap();
let is_set: bool = opt.get();
Implementations§
Trait Implementations§
Source§impl<P: Protocol> GetSocketOption<P> for Broadcast
impl<P: Protocol> GetSocketOption<P> for Broadcast
Source§impl<P: Protocol> SetSocketOption<P> for Broadcast
impl<P: Protocol> SetSocketOption<P> for Broadcast
Auto Trait Implementations§
impl Freeze for Broadcast
impl RefUnwindSafe for Broadcast
impl Send for Broadcast
impl Sync for Broadcast
impl Unpin for Broadcast
impl UnwindSafe for Broadcast
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more