#[non_exhaustive]pub struct ScopeConfig {
pub traffic: Option<Vec<Traffic>>,
pub paths: Vec<String>,
pub methods: Vec<String>,
}Expand description
The traffic a guard covers, and optionally which paths and methods of it.
scope:
traffic: [transcoded, grpc] # or [all]
paths: ["/v1/**", "/acme.v1.Orders/*"]
methods: ["POST"]Omitted keys keep the guard’s own default traffic and cover every path and method of it.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.traffic: Option<Vec<Traffic>>The classes of traffic covered; all names every class.
paths: Vec<String>Path globs (* within a segment, ** across segments) the guard is
narrowed to; empty covers every path. A native gRPC call’s path is
/<package>.<Service>/<Method>.
methods: Vec<String>Methods the guard is narrowed to; empty covers every method. Each is a
standard method or one a route answers (a custom rule, an extra
route); a scope covering the fallback takes any method token.
Implementations§
Source§impl ScopeConfig
impl ScopeConfig
Sourcepub fn traffic(traffic: impl IntoIterator<Item = Traffic>) -> Self
pub fn traffic(traffic: impl IntoIterator<Item = Traffic>) -> Self
A scope covering every path and method of traffic.
§Examples
use structured_proxy::config::{ScopeConfig, Traffic};
let scope = ScopeConfig::traffic([Traffic::Transcoded, Traffic::Grpc]);
assert!(scope.paths.is_empty());Trait Implementations§
Source§impl Clone for ScopeConfig
impl Clone for ScopeConfig
Source§impl Debug for ScopeConfig
impl Debug for ScopeConfig
Source§impl Default for ScopeConfig
impl Default for ScopeConfig
Source§impl<'de> Deserialize<'de> for ScopeConfig
impl<'de> Deserialize<'de> for ScopeConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ScopeConfig
impl RefUnwindSafe for ScopeConfig
impl Send for ScopeConfig
impl Sync for ScopeConfig
impl Unpin for ScopeConfig
impl UnsafeUnpin for ScopeConfig
impl UnwindSafe for ScopeConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request