Don't require &mut self for udpsocket

This commit is contained in:
Aode (lion) 2022-03-05 19:09:31 -06:00
parent af244e252f
commit 4f17580ddd

View file

@ -79,7 +79,7 @@ impl Async<UdpSocket> {
}
pub fn poll_recv_from(
&mut self,
&self,
cx: &mut Context<'_>,
buf: &mut [u8],
) -> Poll<Result<(usize, SocketAddr)>> {
@ -96,7 +96,7 @@ impl Async<UdpSocket> {
}
pub fn recv_from_nonblocking(
&mut self,
&self,
buf: &mut [u8],
) -> Result<Nonblocking<(usize, Option<SocketAddr>)>> {
self.io.try_recv_from(buf)
@ -107,7 +107,7 @@ impl Async<UdpSocket> {
}
pub fn poll_send_to(
&mut self,
&self,
cx: &mut Context<'_>,
buf: &[u8],
target: SocketAddr,
@ -120,7 +120,7 @@ impl Async<UdpSocket> {
}
pub fn send_to_nonblocking(
&mut self,
&self,
buf: &[u8],
target: SocketAddr,
) -> Result<Nonblocking<usize>> {
@ -194,7 +194,7 @@ impl<T: AsFd + 'static> Async<T> {
Poll::Pending
}
fn register_interest(&mut self, cx: &mut Context<'_>, interests: Readiness) {
fn register_interest(&self, cx: &mut Context<'_>, interests: Readiness) {
ReactorRef::with(|mut reactor| {
reactor.register(
Arc::clone(&self.source),
@ -212,7 +212,7 @@ impl<T: AsFd + 'static> Async<T> {
poll_fn(|cx| self.poll_read(cx, buf)).await.map(From::from)
}
fn register_readable(&mut self, cx: &mut Context<'_>) {
fn register_readable(&self, cx: &mut Context<'_>) {
self.register_interest(cx, Readiness::read());
}
@ -257,7 +257,7 @@ impl<T: AsFd + 'static> Async<T> {
poll_fn(|cx| self.poll_write(cx, buf)).await
}
fn register_writable(&mut self, cx: &mut Context<'_>) {
fn register_writable(&self, cx: &mut Context<'_>) {
self.register_interest(cx, Readiness::write());
}