pub struct ProxyRule<'a> {
pub id: usize,
/* private fields */
}
Expand description
Provides methods for managing a proxy rule from the server.
Fields§
§id: usize
Implementations§
Source§impl<'a> ProxyRule<'a>
impl<'a> ProxyRule<'a>
pub fn new(id: usize, server: &'a MockServer) -> Self
Sourcepub fn delete(&mut self)
pub fn delete(&mut self)
Synchronously deletes the proxy rule from the server. This method blocks the current thread until the deletion is complete, ensuring that the rule is removed and will no longer redirect any requests.
§Usage
This method is typically used in synchronous environments where immediate removal of the rule is necessary and can afford a blocking operation.
§Panics
Panics if the deletion fails due to server-related issues such as connectivity problems, or if the rule does not exist on the server.
Sourcepub async fn delete_async(&self)
pub async fn delete_async(&self)
Asynchronously deletes the proxy rule from the server. This method allows for non-blocking operations, suitable for asynchronous environments where tasks are performed concurrently without interrupting the main workflow.
§Usage
Ideal for use in modern async/await patterns in Rust, providing a way to handle resource cleanup without stalling other operations.
§Panics
Panics if the deletion fails due to server-related issues such as connectivity problems, or if the rule does not exist on the server. This method raises an immediate panic to indicate that the operation could not be completed as expected.