Skip to content

Commit

Permalink
feat: Add: 1.Boolean add to_str function.
Browse files Browse the repository at this point in the history
Signed-off-by: photowey <[email protected]>
  • Loading branch information
photowey committed Jul 21, 2024
1 parent 2218fe2 commit 3f88411
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions crates/core/src/primitive/boolean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@ pub enum Boolean {
// ----------------------------------------------------------------

impl Boolean {
pub fn to_string(&self) -> String {
pub fn to_str(&self) -> &str {
match self {
Boolean::True => ONE.to_string(),
Boolean::False => ZERO.to_string(),
Boolean::True => ONE,
Boolean::False => ZERO,
}
}

pub fn to_string(&self) -> String {
self.to_str().to_string()
}

pub fn to_int(&self) -> u8 {
match self {
Boolean::True => ONE_INT,
Expand Down

0 comments on commit 3f88411

Please sign in to comment.