Skip to main content

CoercedSchema

Struct CoercedSchema 

Source
pub struct CoercedSchema<T: FromStr> { /* private fields */ }
Expand description

Parses strings into T: FromStr — the duality citizen with Input = String, Output = T (SC-8), mirroring HTML form input.

Implementations§

Source§

impl<T: FromStr> CoercedSchema<T>

Source

pub fn label(self, label: &'static str) -> Self

Sets the UI label metadata slot.

Source

pub fn description(self, description: &'static str) -> Self

Sets the UI description metadata slot.

Source

pub fn placeholder(self, placeholder: &'static str) -> Self

Sets the UI placeholder metadata slot.

Trait Implementations§

Source§

impl<T: FromStr> Clone for CoercedSchema<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: FromStr> Debug for CoercedSchema<T>

Type-erased debug output.

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: FromStr> Default for CoercedSchema<T>

Creates an empty schema via coerced().

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: FromStr + 'static> DynSchema for CoercedSchema<T>

Source§

fn validate_value(&self, v: &Value) -> Vec<FormaIssue>

Validates an erased value; issues mirror what the typed parse would report.
Source§

fn shape(&self) -> &ShapeNode

Introspection node describing this schema’s kind and constraints, memoized in a per-instance cache on first call.
Source§

fn metadata(&self) -> &FieldMeta

UI-facing metadata slots attached to this schema.
Source§

impl<T: FromStr + ToValue + 'static> ObjectChild for CoercedSchema<T>

Source§

fn validate_at( &self, v: &Value, path: &FieldPath, _fail_fast: bool, ) -> Result<Value, Vec<FormaIssue>>

Validates v addressed at path (already joined by the caller); on full success returns the validated output converted to Value.
Source§

fn shape_node(&self) -> ShapeNode

Introspection projection (delegates to the child’s own shape()).
Source§

fn meta(&self) -> &FieldMeta

UI-facing metadata slots of the child (serves ObjectSchema::field_meta).
Source§

fn clone_boxed(&self) -> Box<dyn ObjectChild>

Crate-internal deep-clone seam powering ObjectSchema: Clone (Field.child is Box<dyn ObjectChild>, which cannot be duplicated without dispatch). Sealed: exactly six impls, all below.
Source§

impl<T: FromStr> Schema for CoercedSchema<T>

Source§

type Input = String

What the schema consumes.
Source§

type Output = T

What the schema produces on success.
Source§

fn parse(&self, input: &Self::Input) -> Result<Self::Output, FormaError>

Validates and parses input; all violated constraints accumulate into one error.
Source§

impl<T: FromStr + ToValue> Sealed for CoercedSchema<T>

Auto Trait Implementations§

§

impl<T> !Freeze for CoercedSchema<T>

§

impl<T> RefUnwindSafe for CoercedSchema<T>
where PhantomData<fn() -> T>: RefUnwindSafe,

§

impl<T> Send for CoercedSchema<T>
where PhantomData<fn() -> T>: Send,

§

impl<T> Sync for CoercedSchema<T>
where PhantomData<fn() -> T>: Sync,

§

impl<T> Unpin for CoercedSchema<T>
where PhantomData<fn() -> T>: Unpin,

§

impl<T> UnsafeUnpin for CoercedSchema<T>
where PhantomData<fn() -> T>: UnsafeUnpin,

§

impl<T> UnwindSafe for CoercedSchema<T>
where PhantomData<fn() -> T>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.