Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert event wait functions back to immutable #380

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1237,8 +1237,8 @@ where
.await
}

pub async fn eth_wait_while<F: FnMut(&mut Self) -> Result<bool, EspError>>(
&mut self,
pub async fn eth_wait_while<F: FnMut(&Self) -> Result<bool, EspError>>(
&self,
mut matcher: F,
timeout: Option<Duration>,
) -> Result<(), EspError> {
Expand All @@ -1259,13 +1259,13 @@ where
self.eth.is_up()
}

pub async fn wait_netif_up(&mut self) -> Result<(), EspError> {
pub async fn wait_netif_up(&self) -> Result<(), EspError> {
self.ip_wait_while(|this| this.eth.is_up().map(|s| !s), Some(CONNECT_TIMEOUT))
.await
}

pub async fn ip_wait_while<F: FnMut(&mut Self) -> Result<bool, EspError>>(
&mut self,
pub async fn ip_wait_while<F: FnMut(&Self) -> Result<bool, EspError>>(
&self,
mut matcher: F,
timeout: Option<core::time::Duration>,
) -> Result<(), EspError> {
Expand Down
10 changes: 5 additions & 5 deletions src/wifi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2377,8 +2377,8 @@ where
/// driver posts a Wifi event on the system event loop. The reasoning behind
/// this is that changes to the state of the Wifi driver are always
/// accompanied by posting Wifi events.
pub async fn wifi_wait<F: FnMut(&mut Self) -> Result<bool, EspError>>(
&mut self,
pub async fn wifi_wait<F: FnMut(&Self) -> Result<bool, EspError>>(
&self,
mut matcher: F,
timeout: Option<Duration>,
) -> Result<(), EspError> {
Expand Down Expand Up @@ -2421,15 +2421,15 @@ where
}

/// Waits until the underlaying network interface is up.
pub async fn wait_netif_up(&mut self) -> Result<(), EspError> {
pub async fn wait_netif_up(&self) -> Result<(), EspError> {
self.ip_wait_while(|this| this.wifi.is_up().map(|s| !s), Some(CONNECT_TIMEOUT))
.await
}

/// As [`AsyncWifi::wifi_wait()`], but for `EspWifi` events related to the
/// IP layer, instead of `WifiDriver` events on the data link layer.
pub async fn ip_wait_while<F: FnMut(&mut Self) -> Result<bool, EspError>>(
&mut self,
pub async fn ip_wait_while<F: FnMut(&Self) -> Result<bool, EspError>>(
&self,
mut matcher: F,
timeout: Option<core::time::Duration>,
) -> Result<(), EspError> {
Expand Down
Loading