pub struct ForwardingRule<'a> {
pub id: usize,
/* private fields */
}Expand description
Represents a forwarding rule on a MockServer, allowing HTTP requests that meet specific criteria to be redirected to a designated destination. Each rule is uniquely identified by an ID within the server context.
Fields§
§id: usizeImplementations§
Source§impl<'a> ForwardingRule<'a>
impl<'a> ForwardingRule<'a>
pub fn new(id: usize, server: &'a MockServer) -> Self
Sourcepub fn delete(&mut self)
pub fn delete(&mut self)
Synchronously deletes the forwarding rule from the mock server. This method blocks the current thread until the deletion has been completed, ensuring that the rule is no longer active and will not affect any further requests.
§Panics
Panics if the deletion fails, typically due to issues such as the rule not existing or server connectivity problems.
Sourcepub async fn delete_async(&self)
pub async fn delete_async(&self)
Asynchronously deletes the forwarding rule from the mock server. This method performs the deletion without blocking the current thread, making it suitable for use in asynchronous applications where maintaining responsiveness or concurrent execution is necessary.
§Panics
Panics if the deletion fails, typically due to issues such as the rule not existing or server connectivity problems. This method will raise an immediate panic on such failures, signaling that the operation could not be completed as expected.