Return `Option<T>` instead of `T` from `interact()`

finchie
Aug 4, 2025, 10:30 AM
3BUFFCHQHO6GJ7NQ3274OZMMOWSGGUEQJWQWQHCTYYXGEGYQGFTAC

Dependencies

  • [2] NEBSVXIA Apply Clippy fixes
  • [3] BAH2JCJP Add progress bar to `fluent_embed_interaction`
  • [4] JUV7C6ET Create initial prototype of `fluent_embed_interaction`
  • [5] QJC4IQIT Refactor `Localize` functions to infallibly return `String`

Change contents

  • replacement in fluent_embed_interaction/src/prompt/select.rs at line 2
    [3.178][3.178:258]()
    use crate::{InteractionEnvironment, InteractionError, NON_INTERACTIVE_MESSAGE};
    [3.178]
    [3.0]
    use crate::{InteractionEnvironment, InteractionError};
  • replacement in fluent_embed_interaction/src/prompt/select.rs at line 27
    [3.1149][3.1149:1250]()
    pub fn interact(self, environment: &InteractionEnvironment) -> Result<usize, InteractionError> {
    [3.1149]
    [3.1250]
    pub fn interact(
    self,
    environment: &InteractionEnvironment,
    ) -> Result<Option<usize>, InteractionError> {
  • replacement in fluent_embed_interaction/src/prompt/select.rs at line 47
    [3.1810][3.1810:1849]()
    Ok(prompt.interact()?)
    [3.1810]
    [3.1849]
    Ok(Some(prompt.interact()?))
  • replacement in fluent_embed_interaction/src/prompt/select.rs at line 49
    [3.1863][3.1863:1957]()
    crate::InteractionContext::NonInteractive => panic!("{NON_INTERACTIVE_MESSAGE}"),
    [3.1863]
    [3.1957]
    crate::InteractionContext::NonInteractive => Ok(None),
  • replacement in fluent_embed_interaction/src/prompt/password.rs at line 2
    [3.2083][3.2083:2163]()
    use crate::{InteractionEnvironment, InteractionError, NON_INTERACTIVE_MESSAGE};
    [3.2083]
    [3.152]
    use crate::{InteractionEnvironment, InteractionError};
  • replacement in fluent_embed_interaction/src/prompt/password.rs at line 41
    [3.3305][3.3305:3349]()
    ) -> Result<String, InteractionError> {
    [3.3305]
    [3.3349]
    ) -> Result<Option<String>, InteractionError> {
  • replacement in fluent_embed_interaction/src/prompt/password.rs at line 59
    [3.4010][3.4010:4049]()
    Ok(prompt.interact()?)
    [3.4010]
    [3.4049]
    Ok(Some(prompt.interact()?))
  • replacement in fluent_embed_interaction/src/prompt/password.rs at line 61
    [3.4063][3.4063:4157]()
    crate::InteractionContext::NonInteractive => panic!("{NON_INTERACTIVE_MESSAGE}"),
    [3.4063]
    [3.4157]
    crate::InteractionContext::NonInteractive => Ok(None),
  • replacement in fluent_embed_interaction/src/prompt/input.rs at line 2
    [3.6559][3.6559:6639]()
    use crate::{InteractionEnvironment, InteractionError, NON_INTERACTIVE_MESSAGE};
    [3.6559]
    [3.704]
    use crate::{InteractionEnvironment, InteractionError};
  • replacement in fluent_embed_interaction/src/prompt/input.rs at line 27
    [3.7322][3.7322:7366]()
    ) -> Result<String, InteractionError> {
    [3.7322]
    [3.7366]
    ) -> Result<Option<String>, InteractionError> {
  • replacement in fluent_embed_interaction/src/prompt/input.rs at line 44
    [3.7939][3.7939:7978]()
    Ok(prompt.interact()?)
    [3.7939]
    [3.7978]
    Ok(Some(prompt.interact()?))
  • replacement in fluent_embed_interaction/src/prompt/input.rs at line 46
    [3.7992][3.7992:8086]()
    crate::InteractionContext::NonInteractive => panic!("{NON_INTERACTIVE_MESSAGE}"),
    [3.7992]
    [3.8086]
    crate::InteractionContext::NonInteractive => Ok(None),
  • replacement in fluent_embed_interaction/src/prompt/confirm.rs at line 2
    [3.8209][3.8209:8289]()
    use crate::{InteractionEnvironment, InteractionError, NON_INTERACTIVE_MESSAGE};
    [3.8209]
    [3.8338]
    use crate::{InteractionEnvironment, InteractionError};
  • replacement in fluent_embed_interaction/src/prompt/confirm.rs at line 15
    [3.8536][3.8536:8636]()
    pub fn interact(self, environment: &InteractionEnvironment) -> Result<bool, InteractionError> {
    [3.8536]
    [3.8636]
    pub fn interact(
    self,
    environment: &InteractionEnvironment,
    ) -> Result<Option<bool>, InteractionError> {
  • replacement in fluent_embed_interaction/src/prompt/confirm.rs at line 31
    [3.9072][3.9072:9111]()
    Ok(prompt.interact()?)
    [3.9072]
    [3.9111]
    Ok(Some(prompt.interact()?))
  • replacement in fluent_embed_interaction/src/prompt/confirm.rs at line 33
    [3.9125][3.9125:9219]()
    crate::InteractionContext::NonInteractive => panic!("{NON_INTERACTIVE_MESSAGE}"),
    [3.9125]
    [3.9219]
    crate::InteractionContext::NonInteractive => Ok(None),
  • edit in fluent_embed_interaction/src/lib.rs at line 12
    [3.1849][3.9386:9387](),[3.9386][3.9386:9387](),[3.9507][3.9507:9606]()
    const NON_INTERACTIVE_MESSAGE: &str = "Attempted to prompt the user in a non-interactive context";
  • replacement in fluent_embed_interaction/src/editor.rs at line 1
    [3.10371][3.10372:10479]()
    use crate::{
    InteractionContext, InteractionEnvironment, InteractionError, NON_INTERACTIVE_MESSAGE,
    };
    [3.10371]
    [3.10479]
    use crate::{InteractionContext, InteractionEnvironment, InteractionError};
  • replacement in fluent_embed_interaction/src/editor.rs at line 14
    [3.10548][2.457:502]()
    #[must_use] pub const fn new() -> Self {
    [3.10548]
    [3.10575]
    #[must_use]
    pub const fn new() -> Self {
  • replacement in fluent_embed_interaction/src/editor.rs at line 19
    [3.10615][2.503:578]()
    #[must_use] pub fn with_extension(mut self, extension: &str) -> Self {
    [3.10615]
    [3.10678]
    #[must_use]
    pub fn with_extension(mut self, extension: &str) -> Self {
  • replacement in fluent_embed_interaction/src/editor.rs at line 40
    [3.11224][3.11224:11311]()
    InteractionContext::NonInteractive => panic!("{NON_INTERACTIVE_MESSAGE}"),
    [3.11224]
    [3.11311]
    InteractionContext::NonInteractive => Ok(None),