#[non_exhaustive]pub struct ContextRule {
pub selector: String,
pub requested: Vec<String>,
pub provided: Vec<String>,
pub allowed_request_extensions: Vec<String>,
pub allowed_response_extensions: Vec<String>,
/* private fields */
}Expand description
A context rule provides information about the context for an individual API element.
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.selector: StringSelects the methods to which this rule applies.
Refer to selector for syntax details.
requested: Vec<String>A list of full type names of requested contexts, only the requested context will be made available to the backend.
provided: Vec<String>A list of full type names of provided contexts. It is used to support propagating HTTP headers and ETags from the response extension.
allowed_request_extensions: Vec<String>A list of full type names or extension IDs of extensions allowed in grpc side channel from client to backend.
allowed_response_extensions: Vec<String>A list of full type names or extension IDs of extensions allowed in grpc side channel from backend to client.
Implementations§
Source§impl ContextRule
impl ContextRule
pub fn new() -> Self
Sourcepub fn set_selector<T: Into<String>>(self, v: T) -> Self
pub fn set_selector<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_requested<T, V>(self, v: T) -> Self
pub fn set_requested<T, V>(self, v: T) -> Self
Sourcepub fn set_provided<T, V>(self, v: T) -> Self
pub fn set_provided<T, V>(self, v: T) -> Self
Sourcepub fn set_allowed_request_extensions<T, V>(self, v: T) -> Self
pub fn set_allowed_request_extensions<T, V>(self, v: T) -> Self
Sets the value of allowed_request_extensions.
§Example
ⓘ
let x = ContextRule::new().set_allowed_request_extensions(["a", "b", "c"]);Sourcepub fn set_allowed_response_extensions<T, V>(self, v: T) -> Self
pub fn set_allowed_response_extensions<T, V>(self, v: T) -> Self
Sets the value of allowed_response_extensions.
§Example
ⓘ
let x = ContextRule::new().set_allowed_response_extensions(["a", "b", "c"]);Trait Implementations§
Source§impl Clone for ContextRule
impl Clone for ContextRule
Source§fn clone(&self) -> ContextRule
fn clone(&self) -> ContextRule
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContextRule
impl Debug for ContextRule
Source§impl Default for ContextRule
impl Default for ContextRule
Source§fn default() -> ContextRule
fn default() -> ContextRule
Returns the “default value” for a type. Read more
Source§impl Message for ContextRule
impl Message for ContextRule
Source§impl PartialEq for ContextRule
impl PartialEq for ContextRule
impl StructuralPartialEq for ContextRule
Auto Trait Implementations§
impl Freeze for ContextRule
impl RefUnwindSafe for ContextRule
impl Send for ContextRule
impl Sync for ContextRule
impl Unpin for ContextRule
impl UnwindSafe for ContextRule
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