Skip to main content

mcpr_core/proxy/pipeline/
stubs.rs

1//! Small shared types referenced by `values.rs`.
2//!
3//! `SessionId` and `TagSet` are load-bearing — middlewares construct
4//! and mutate them through the pipeline. `UrlMap` and `OAuthKind` exist
5//! so `Request::OAuth` / `Route::Oauth` have inhabited argument types;
6//! intake does not yet produce OAuth classifications.
7
8#[derive(Debug, Clone, PartialEq, Eq, Hash)]
9pub struct SessionId(pub String);
10
11impl SessionId {
12    pub fn new(s: impl Into<String>) -> Self {
13        Self(s.into())
14    }
15
16    pub fn as_str(&self) -> &str {
17        &self.0
18    }
19}
20
21#[derive(Debug, Clone, Default)]
22pub struct UrlMap;
23
24#[derive(Debug, Clone, Copy, PartialEq, Eq)]
25pub enum OAuthKind {
26    Discovery,
27    Token,
28    Callback,
29    Unknown,
30}
31
32#[derive(Debug, Clone, Default, PartialEq, Eq)]
33pub struct TagSet(pub Vec<&'static str>);
34
35impl TagSet {
36    pub fn push(&mut self, tag: &'static str) {
37        self.0.push(tag);
38    }
39
40    pub fn as_slice(&self) -> &[&'static str] {
41        &self.0
42    }
43}