pub struct MockIgdServer { /* private fields */ }Expand description
A mock UPnP IGD server for testing.
Implementations§
Source§impl MockIgdServer
impl MockIgdServer
Sourcepub fn builder() -> MockIgdServerBuilder
pub fn builder() -> MockIgdServerBuilder
Create a builder for configuring the server.
Sourcepub fn control_url(&self) -> String
pub fn control_url(&self) -> String
Get the control URL for SOAP actions.
Sourcepub fn description_url(&self) -> String
pub fn description_url(&self) -> String
Get the device description URL.
Sourcepub fn http_addr(&self) -> SocketAddr
pub fn http_addr(&self) -> SocketAddr
Get the HTTP server address.
Sourcepub fn ssdp_addr(&self) -> Option<SocketAddr>
pub fn ssdp_addr(&self) -> Option<SocketAddr>
Get the SSDP server address (if enabled).
Sourcepub async fn mock(
&self,
action: impl Into<Action>,
responder: impl Into<Responder>,
)
pub async fn mock( &self, action: impl Into<Action>, responder: impl Into<Responder>, )
Register a mock for the given action.
Sourcepub async fn mock_with_priority(
&self,
action: impl Into<Action>,
responder: impl Into<Responder>,
priority: u32,
)
pub async fn mock_with_priority( &self, action: impl Into<Action>, responder: impl Into<Responder>, priority: u32, )
Register a mock with a specific priority (higher = checked first).
Sourcepub async fn mock_with_times(
&self,
action: impl Into<Action>,
responder: impl Into<Responder>,
times: u32,
)
pub async fn mock_with_times( &self, action: impl Into<Action>, responder: impl Into<Responder>, times: u32, )
Register a mock that only matches a limited number of times.
Sourcepub async fn clear_mocks(&self)
pub async fn clear_mocks(&self)
Clear all registered mocks.
Sourcepub async fn received_requests(&self) -> Vec<ReceivedRequest>
pub async fn received_requests(&self) -> Vec<ReceivedRequest>
Sourcepub async fn clear_received_requests(&self)
pub async fn clear_received_requests(&self)
Clear all received requests.
Sourcepub async fn received_ssdp_requests(&self) -> Vec<ReceivedSsdpRequest>
pub async fn received_ssdp_requests(&self) -> Vec<ReceivedSsdpRequest>
Get all received SSDP requests (M-SEARCH).
Returns a list of all SSDP M-SEARCH requests received by the server. Useful for verifying device discovery behavior.
§Example
ⓘ
let requests = server.received_ssdp_requests().await;
assert_eq!(requests.len(), 1);
assert_eq!(requests[0].search_target, "ssdp:all");Sourcepub async fn clear_received_ssdp_requests(&self)
pub async fn clear_received_ssdp_requests(&self)
Clear all received SSDP requests.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MockIgdServer
impl !RefUnwindSafe for MockIgdServer
impl Send for MockIgdServer
impl Sync for MockIgdServer
impl Unpin for MockIgdServer
impl !UnwindSafe for MockIgdServer
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