MCPcopy Create free account
hub / github.com/Rust-Web-Development/code / from_str

Method from_str

ch_04/ch_04-s4.1.2/src/main.rs:68–73  ·  view source on GitHub ↗
(id: &str)

Source from the content-addressed store, hash-verified

66 type Err = std::io::Error;
67
68 fn from_str(id: &str) -> Result<Self, Self::Err> {
69 match id.is_empty() {
70 false => Ok(QuestionId(id.to_string())),
71 true => Err(Error::new(ErrorKind::InvalidInput, "No id provided")),
72 }
73 }
74}
75
76

Callers

nothing calls this directly

Calls 1

QuestionIdClass · 0.70

Tested by

no test coverage detected