TextSubtype

Trait TextSubtype 

Source
pub trait TextSubtype:
    Debug
    + Clone
    + Copy
    + Default
    + Send
    + Sync
    + 'static {
    // Required method
    fn name() -> &'static str;

    // Provided methods
    fn pattern() -> Option<&'static str> { ... }
    fn placeholder() -> Option<&'static str> { ... }
    fn is_multiline() -> bool { ... }
    fn is_sensitive() -> bool { ... }
    fn code_language() -> Option<&'static str> { ... }
}
Expand description

Trait for text subtypes with semantic meaning.

Text subtypes provide:

  • Pattern hints for validation
  • Placeholder text for UI
  • Semantic meaning for proper rendering

§Example

use paramdef::subtype::{TextSubtype, Email};

let pattern = Email::pattern();
let placeholder = Email::placeholder();

Required Methods§

Source

fn name() -> &'static str

Returns the name of this subtype.

Provided Methods§

Source

fn pattern() -> Option<&'static str>

Returns a regex pattern for validation, if any.

Source

fn placeholder() -> Option<&'static str>

Returns placeholder text for UI.

Source

fn is_multiline() -> bool

Returns whether the input should be multiline.

Source

fn is_sensitive() -> bool

Returns whether the value is sensitive (passwords, tokens).

Source

fn code_language() -> Option<&'static str>

Returns the associated code language for code subtypes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl TextSubtype for ApiKey

Source§

impl TextSubtype for BearerToken

Source§

impl TextSubtype for Country

Source§

impl TextSubtype for Cron

Source§

impl TextSubtype for CurrencyCode

Source§

impl TextSubtype for Date

Source§

impl TextSubtype for DateTime

Source§

impl TextSubtype for DirPath

Source§

impl TextSubtype for Domain

Source§

impl TextSubtype for Email

Source§

impl TextSubtype for Expression

Source§

impl TextSubtype for FileName

Source§

impl TextSubtype for FilePath

Source§

impl TextSubtype for HexColor

Source§

impl TextSubtype for Hostname

Source§

impl TextSubtype for Html

Source§

impl TextSubtype for IpAddressV4

Source§

impl TextSubtype for IpAddressV6

Source§

impl TextSubtype for Iso8601Duration

Source§

impl TextSubtype for JavaScript

Source§

impl TextSubtype for Json

Source§

impl TextSubtype for Language

Source§

impl TextSubtype for MacAddress

Source§

impl TextSubtype for Markdown

Source§

impl TextSubtype for MultiLine

Source§

impl TextSubtype for Password

Source§

impl TextSubtype for PhoneNumber

Source§

impl TextSubtype for Plain

Source§

impl TextSubtype for Python

Source§

impl TextSubtype for Regex

Source§

impl TextSubtype for Rust

Source§

impl TextSubtype for Secret

Source§

impl TextSubtype for Semver

Source§

impl TextSubtype for Slug

Source§

impl TextSubtype for Sql

Source§

impl TextSubtype for Time

Source§

impl TextSubtype for Timezone

Source§

impl TextSubtype for Toml

Source§

impl TextSubtype for Url

Source§

impl TextSubtype for Uuid

Source§

impl TextSubtype for Xml

Source§

impl TextSubtype for Yaml