pub struct PromptDef { /* private fields */ }Expand description
A registered prompt: its protocol description plus its entry point.
Implementations§
Source§impl PromptDef
impl PromptDef
Sourcepub fn new(prompt: Prompt, get: GetFn) -> Self
pub fn new(prompt: Prompt, get: GetFn) -> Self
Creates a definition from the protocol description and entry point.
Sourcepub fn scopes<I, S>(self, scopes: I) -> Self
pub fn scopes<I, S>(self, scopes: I) -> Self
Declares the OAuth scopes a caller needs (all of them). Enforced when
the HTTP transport requires OAuth; the client gets 403 with an
insufficient_scope challenge listing these scopes.
Sourcepub fn required_scopes(&self) -> &[String]
pub fn required_scopes(&self) -> &[String]
The OAuth scopes declared with scopes.
Sourcepub fn require_state<T: Send + Sync + 'static>(self) -> Self
pub fn require_state<T: Send + Sync + 'static>(self) -> Self
Declares that the prompt needs shared state of type T.
Sourcepub fn complete(self, argument: impl Into<String>, complete: CompleteFn) -> Self
pub fn complete(self, argument: impl Into<String>, complete: CompleteFn) -> Self
Attaches a completion provider to an argument.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PromptDef
impl RefUnwindSafe for PromptDef
impl Send for PromptDef
impl Sync for PromptDef
impl Unpin for PromptDef
impl UnsafeUnpin for PromptDef
impl UnwindSafe for PromptDef
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