pub struct ResourceTemplate { /* private fields */ }Expand description
A template for resources that can be dynamically generated
Implementations§
Source§impl ResourceTemplate
impl ResourceTemplate
Sourcepub fn new(uri_template: impl Into<String>) -> Self
pub fn new(uri_template: impl Into<String>) -> Self
Create a new resource template with the given URI pattern
Sourcepub fn with_list<F, Fut>(self, callback: F) -> Self
pub fn with_list<F, Fut>(self, callback: F) -> Self
Add a callback to list all resources matching this template
Sourcepub fn with_completion(
self,
variable: impl Into<String>,
completable: impl Completable<Input = str, Output = String> + 'static,
) -> Self
pub fn with_completion( self, variable: impl Into<String>, completable: impl Completable<Input = str, Output = String> + 'static, ) -> Self
Add a completion callback for a template variable
Sourcepub fn uri_template(&self) -> &str
pub fn uri_template(&self) -> &str
Get the URI template pattern
Sourcepub fn list_callback(&self) -> Option<&dyn ListResourcesCallback>
pub fn list_callback(&self) -> Option<&dyn ListResourcesCallback>
Get the list callback if one exists
Sourcepub fn complete_callback(
&self,
variable: &str,
) -> Option<&dyn Completable<Input = str, Output = String>>
pub fn complete_callback( &self, variable: &str, ) -> Option<&dyn Completable<Input = str, Output = String>>
Get the completion callback for a variable if one exists
Auto Trait Implementations§
impl Freeze for ResourceTemplate
impl !RefUnwindSafe for ResourceTemplate
impl !Send for ResourceTemplate
impl !Sync for ResourceTemplate
impl Unpin for ResourceTemplate
impl !UnwindSafe for ResourceTemplate
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> 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