MCPcopy Index your code
hub / github.com/endbasic/endbasic / parse

Method parse

std/src/gpio/mod.rs:75–83  ·  view source on GitHub ↗

Obtains a `PinMode` from a value.

(s: &str)

Source from the content-addressed store, hash-verified

73impl PinMode {
74 /// Obtains a `PinMode` from a value.
75 fn parse(s: &str) -> Result<PinMode, String> {
76 match s.to_ascii_uppercase().as_ref() {
77 "IN" => Ok(PinMode::In),
78 "IN-PULL-UP" => Ok(PinMode::InPullUp),
79 "IN-PULL-DOWN" => Ok(PinMode::InPullDown),
80 "OUT" => Ok(PinMode::Out),
81 s => Err(format!("Unknown pin mode {}", s)),
82 }
83 }
84}
85
86fn parse_pin(scope: &Scope<'_>, narg: u8) -> CallResult<Pin> {

Callers 1

parse_numeric_prefixFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected