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

Method from_str

ch_02/src/main.rs:31–36  ·  view source on GitHub ↗
(id: &str)

Source from the content-addressed store, hash-verified

29 type Err = std::io::Error;
30
31 fn from_str(id: &str) -> Result<Self, Self::Err> {
32 match id.is_empty() {
33 false => Ok(QuestionId(id.to_string())),
34 true => Err(Error::new(ErrorKind::InvalidInput, "No id provided")),
35 }
36 }
37}
38
39#[tokio::main]

Callers

nothing calls this directly

Calls 1

QuestionIdClass · 0.70

Tested by

no test coverage detected