Skip to main content

lingxia_platform/traits/
network.rs

1use std::future::Future;
2
3use crate::error::PlatformError;
4
5pub trait Network: Send + Sync + 'static {
6    fn get_network_info(&self) -> impl Future<Output = Result<String, PlatformError>> + Send {
7        async {
8            Err(PlatformError::NotSupported(
9                "get_network_info not implemented".to_string(),
10            ))
11        }
12    }
13
14    /// Add listener for network changes. Keeps callback_id for stream callbacks.
15    fn add_network_change_listener(&self, callback_id: u64) -> Result<(), PlatformError> {
16        let _ = callback_id;
17        Err(PlatformError::NotSupported(
18            "add_network_change_listener not implemented".to_string(),
19        ))
20    }
21
22    /// Remove a previously registered network change listener.
23    fn remove_network_change_listener(&self, callback_id: u64) -> Result<(), PlatformError> {
24        let _ = callback_id;
25        Err(PlatformError::NotSupported(
26            "remove_network_change_listener not implemented".to_string(),
27        ))
28    }
29}