pub struct Namespace { /* private fields */ }
Expand description
Namespace
bind with apis and forms an intermediate layer of API. It self
doesn’t do a thing but it will.
It’s name is used to distinguish with other peer APIs and all the sub-API
will not see the namespace name segments in the request. If you want the
namespace it self to have some functionalities, you need to create a sub-API
and name it &[]
. But such design is not recommended because it sometimes
will make the API work in a weird way, especially when path variables are
involved, i.e. the trailing part of the path is used as a variable.
Implementations§
Trait Implementations§
Source§impl Api for Namespace
impl Api for Namespace
Source§fn route(&self, req: &mut Request) -> ApiResult
fn route(&self, req: &mut Request) -> ApiResult
The route function here will ask every sub-API to make an response in binding order. The collection routing is short-circuiting, i.e., once a sub-API responded, the response is returned and the following it won’t check the remaining unchecked sub-apis.