From f1204790302c74cf7ff8c705492e3b1e4031937e Mon Sep 17 00:00:00 2001 From: augustin <73721937+augustin-v@users.noreply.github.com> Date: Tue, 17 Feb 2026 07:27:14 +0900 Subject: [PATCH] docs(actix-router): document Resource trait (#3935) Co-authored-by: Yuki Okushi --- actix-router/src/resource_path.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/actix-router/src/resource_path.rs b/actix-router/src/resource_path.rs index 610dc344d..8823108ae 100644 --- a/actix-router/src/resource_path.rs +++ b/actix-router/src/resource_path.rs @@ -1,11 +1,16 @@ use crate::Path; -// TODO: this trait is necessary, document it -// see impl Resource for ServiceRequest +/// Abstraction over types that can provide a mutable [`Path`] for routing. +/// +/// This trait is used by the router to extract the request path in a uniform way across different +/// request types (e.g., Actix Web's `ServiceRequest`). Implementors return a mutable [`Path`] +/// wrapper so routing can read and potentially normalize/parse the path without requiring the +/// original request type. pub trait Resource { /// Type of resource's path returned in `resource_path`. type Path: ResourcePath; + /// Returns a mutable reference to the path wrapper used by the router. fn resource_path(&mut self) -> &mut Path; }