pub struct Validator;Expand description
Validation helper - unit struct with validation methods.
This demonstrates a unit struct with associated methods. Even though there’s only one value, agents can elicit it to get a type-safe handle.
Implementations§
Source§impl Validator
impl Validator
Sourcepub fn is_non_empty(&self, s: &str) -> bool
pub fn is_non_empty(&self, s: &str) -> bool
Check if string is non-empty.
Sourcepub fn is_in_range<T: PartialOrd>(&self, value: T, min: T, max: T) -> bool
pub fn is_in_range<T: PartialOrd>(&self, value: T, min: T, max: T) -> bool
Check if value is in range.
Trait Implementations§
Source§impl Elicitation for Validator
impl Elicitation for Validator
Source§async fn elicit(_client: &ElicitClient<'_>) -> ElicitResult<Self>
async fn elicit(_client: &ElicitClient<'_>) -> ElicitResult<Self>
Elicit a value of this type from the user via style-aware client. Read more
Source§fn with_style(style: Self::Style) -> ElicitBuilder<Self>
fn with_style(style: Self::Style) -> ElicitBuilder<Self>
Create a builder for one-off style override. Read more
Source§fn elicit_proven(
client: &ElicitClient<'_>,
) -> impl Future<Output = ElicitResult<(Self, Established<Is<Self>>)>> + Send
fn elicit_proven( client: &ElicitClient<'_>, ) -> impl Future<Output = ElicitResult<(Self, Established<Is<Self>>)>> + Send
Elicit a value with proof it inhabits type Self. Read more
impl Copy for Validator
impl Eq for Validator
impl StructuralPartialEq for Validator
Auto Trait Implementations§
impl Freeze for Validator
impl RefUnwindSafe for Validator
impl Send for Validator
impl Sync for Validator
impl Unpin for Validator
impl UnwindSafe for Validator
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> WithContract for T
impl<T> WithContract for T
Source§fn with_contract<C>(contract: C) -> ContractedElicitation<Self, C>
fn with_contract<C>(contract: C) -> ContractedElicitation<Self, C>
Attach a contract to this type’s elicitation. Read more