Skip to main content

set_string_value

Function set_string_value 

Source
pub fn set_string_value<'input, const BORROW: bool>(
    wip: Partial<'input, BORROW>,
    s: Cow<'input, str>,
    span: Option<Span>,
) -> Result<Partial<'input, BORROW>, DessertError>
Expand description

Set a string value, handling Option<T>, parseable types, enums, and string types.

This function handles:

  1. Option<T> - unwraps to Some and recurses
  2. Types with parse_from_str (numbers, bools, etc.)
  3. Enums - selects variant by name (externally tagged) or by discriminant (numeric)
  4. Transparent structs (newtypes) - recurses into inner type
  5. String types (&str, Cow<str>, String)