Public declaration syntax from forge-rs/crates/forge-settings/src/lib.rs Original source SHA-256: 52dd3b7cafa5724a3d1ffa5c9792ae487221de94cec38aa107d1289e54d9dc69 Function bodies and constant values are omitted. This is not the complete implementation. Source line 72 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct ProviderSettingField { /// Stable identifier (e.g. `"api_key"`, `"base_url"`). pub id: String, /// User-visible label. pub label: String, /// One-line description. pub description: String, /// What kind of value the field holds. pub kind: ProviderSettingKind, /// Current value, already redacted for secret fields. pub value: String, /// `true` when the value is sensitive — runtimes should never /// log it and should display it as `••••••` by default. pub secret: bool, /// `true` when this field is the currently-active enum / picker /// selection. pub active: bool } Source line 94 #[must_use] pub fn text(id: impl Into, label: impl Into, value: impl Into) -> Self; Source line 110 #[must_use] pub fn secret_text( id: impl Into, label: impl Into, value: impl Into, ) -> Self; Source line 128 #[must_use] pub fn integer(id: impl Into, label: impl Into, value: i64) -> Self; Source line 142 #[must_use] pub fn boolean(id: impl Into, label: impl Into, value: bool) -> Self; Source line 157 #[must_use] pub fn picker( id: impl Into, label: impl Into, current_id: impl Into, options: Vec, ) -> Self; Source line 177 #[must_use] pub fn description(mut self, text: impl Into) -> Self; Source line 184 #[must_use] pub fn active(mut self, on: bool) -> Self; Source line 193 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(tag = "kind", rename_all = "kebab-case")] pub enum ProviderSettingKind { /// Free-form string (api keys, urls, region names). Text, /// Whole-number integer (timeouts, retries). Integer, /// Boolean toggle. Bool, /// Enum picker with a fixed option list. Picker { /// Available choices — the runtime renders these as a sub-page. options: Vec, }, } Source line 209 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct ProviderSettingOption { /// Stable identifier of the option. pub id: String, /// User-visible label. pub label: String, /// Optional one-line description. pub description: String } Source line 221 #[must_use] pub fn new(id: impl Into, label: impl Into) -> Self; Source line 231 #[must_use] pub fn description(mut self, text: impl Into) -> Self; Source line 240 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(tag = "kind", rename_all = "kebab-case")] pub enum FieldError { /// The field id is not recognized by this provider. UnknownField(String), /// The supplied value failed validation. InvalidValue(String), /// The field is read-only. ReadOnly(String), } Source line 263 pub trait ProviderSettings { /// Stable provider identifier (e.g. `"anthropic"`, `"openai"`). fn provider_id(&self) -> &str; /// All fields the runtime should display, in render order. fn fields(&self) -> Vec; /// Update one field. The provider validates the value and /// returns [`FieldError`] on rejection. Default implementation /// returns `ReadOnly` for every field — providers that want to /// support editing must override. /// /// # Errors /// /// Returns [`FieldError`] for unknown fields, invalid values, or /// read-only fields. fn set_field(&mut self, id: &str, _value: &str) -> Result<(), FieldError> ; }