-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from supabase/text-format
add support for parsing values from text format
- Loading branch information
Showing
7 changed files
with
420 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use thiserror::Error; | ||
|
||
#[derive(Debug, Error)] | ||
pub enum ParseBoolError { | ||
#[error("invalid input value: {0}")] | ||
InvalidInput(String), | ||
} | ||
|
||
pub fn parse_bool(s: &str) -> Result<bool, ParseBoolError> { | ||
if s == "t" { | ||
Ok(true) | ||
} else if s == "f" { | ||
Ok(false) | ||
} else { | ||
Err(ParseBoolError::InvalidInput(s.to_string())) | ||
} | ||
} |
Oops, something went wrong.