pub struct HttpPattern {
pub template: String,
pub segments: Vec<UrlSegment>,
pub parameters: Vec<String>,
pub static_prefix: String,
pub static_suffix: Option<String>,
}Expand description
Parsed representation of an HTTP rule pattern
The Default is an empty pattern (no template, no segments). It exists for client protocols
that carry no HTTP routing (e.g. ConnectRPC), where a MethodPlan still needs an http_pattern
field but the REST emitters that read it are never invoked.
Fields§
§template: StringThe original template string
segments: Vec<UrlSegment>Parsed segments in order
parameters: Vec<String>Just the parameter names in order (for backward compatibility)
static_prefix: StringStatic prefix (everything before the first parameter)
static_suffix: Option<String>Static suffix (everything after the last parameter)
Implementations§
Source§impl HttpPattern
impl HttpPattern
pub fn ends_with_static(&self) -> bool
pub fn ends_with_parameter(&self) -> bool
Sourcepub fn parameter_names(&self) -> &[String]
pub fn parameter_names(&self) -> &[String]
Get parameter names in the order they appear in the URL
Sourcepub fn to_format_string(&self) -> (String, Vec<String>)
pub fn to_format_string(&self) -> (String, Vec<String>)
Generate a format string for URL construction Returns (“/catalogs/{}”, [“name”]) for “/catalogs/{name}”
Trait Implementations§
Source§impl Clone for HttpPattern
impl Clone for HttpPattern
Source§impl Debug for HttpPattern
impl Debug for HttpPattern
Auto Trait Implementations§
impl Freeze for HttpPattern
impl RefUnwindSafe for HttpPattern
impl Send for HttpPattern
impl Sync for HttpPattern
impl Unpin for HttpPattern
impl UnsafeUnpin for HttpPattern
impl UnwindSafe for HttpPattern
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,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more