Skip to content

Commit

Permalink
feat(lib): implement FromStr for DnotePageInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
deepanchal committed Jul 8, 2023
1 parent 00b85d7 commit 1823c2c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/dnote_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ pub struct DnotePageInfo {
pub content: String,
}

impl FromStr for DnotePageInfo {
type Err = ();
fn from_str(s: &str) -> Result<Self, Self::Err> {
let content = s.trim().to_string();
Ok(DnotePageInfo { content })
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down

0 comments on commit 1823c2c

Please sign in to comment.