Skip to main content

FormField

Struct FormField 

Source
pub struct FormField {
    pub name: String,
    pub label: String,
    pub field_type: FieldType,
    pub required: bool,
    pub placeholder: Option<String>,
    pub help_text: Option<String>,
    pub default_value: Option<String>,
    pub group: Option<String>,
    pub env: Vec<String>,
}
Expand description

A single form field.

Fields§

§name: String

Field name used as the key when submitting (e.g. “api_key”).

§label: String

Label shown next to the input.

§field_type: FieldType

Input type.

§required: bool

Whether the field is required.

§placeholder: Option<String>

Placeholder text inside the input.

§help_text: Option<String>

Help text shown below the input.

§default_value: Option<String>

Default value the UI pre-fills (e.g. an OAuth scope or AWS region). The stored credential omits unfilled optional fields, so drivers still apply their own defaults; this only seeds the form input.

§group: Option<String>

Mutually-exclusive group label this field belongs to. Fields sharing a label are one alternative credential method (e.g. “API key” vs “OAuth”); ungrouped fields are always part of the credential. None for the common single-method case.

§env: Vec<String>

Environment variables this field can be read from in standalone/dev use, most preferred first.

Declared by the driver, because only the driver knows what its vendor’s own SDK reads: AWS_ACCESS_KEY_ID for Bedrock, AZURE_TENANT_ID for MAI’s Entra group, ANTHROPIC_API_KEY for Anthropic. Later entries are alternates the vendor also honors (GOOGLE_API_KEY, AWS_DEFAULT_REGION), not a second field.

Empty means the field cannot be supplied from the environment, so a group containing a required field with no variable never resolves from env alone. Server credential resolution ignores this entirely.

Implementations§

Source§

impl FormField

Source

pub fn password(name: impl Into<String>, label: impl Into<String>) -> FormField

A masked password/secret field.

Source

pub fn text(name: impl Into<String>, label: impl Into<String>) -> FormField

A plain text field.

Source

pub fn required(self) -> FormField

Mark the field as required.

Source

pub fn with_placeholder(self, placeholder: impl Into<String>) -> FormField

Set placeholder text.

Source

pub fn with_help(self, help_text: impl Into<String>) -> FormField

Set help text shown below the input.

Source

pub fn with_default(self, default_value: impl Into<String>) -> FormField

Set a default value the form pre-fills.

Source

pub fn in_group(self, group: impl Into<String>) -> FormField

Assign the field to a mutually-exclusive credential group.

Source

pub fn env(self, name: impl Into<String>) -> FormField

Declare the environment variable this field is read from, following the vendor’s own SDK convention.

Source

pub fn env_fallback(self, name: impl Into<String>) -> FormField

Declare a further variable the vendor also honors, tried after the ones already declared.

Trait Implementations§

Source§

impl Clone for FormField

Source§

fn clone(&self) -> FormField

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 Debug for FormField

Source§

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

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

impl Default for FormField

Source§

fn default() -> FormField

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

impl Serialize for FormField

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more