Skip to content

Commit

Permalink
fix: correctly read boolean fields
Browse files Browse the repository at this point in the history
  • Loading branch information
zabackary committed Jul 9, 2024
1 parent 0b28bec commit fe113ec
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rtd_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl<DS: data_source::RTDStateDataSource> RTDState<DS> {
/// format.
pub fn field_bool(&self, item: usize) -> Result<bool, RTDStateFieldError> {
self.field_str(item, 1, RTDFieldJustification::None)
.map(|char| !char.is_empty())
.map(|char| !char.trim().is_empty())
}
}

Expand Down Expand Up @@ -221,7 +221,7 @@ impl std::error::Error for RTDStateFieldError {}

/// The justification of the field in the RTDState
///
/// Passing `Left` will trip the right side of the value for whitespace, `Right`
/// Passing `Left` will trim the right side of the value for whitespace, `Right`
/// will trim the left, and `None` will avoid whitespace processing and will
/// return the raw value.
#[derive(Debug)]
Expand Down

0 comments on commit fe113ec

Please sign in to comment.