MCPcopy Index your code
hub / github.com/cargo-lambda/cargo-lambda / parse_ref

Method parse_ref

crates/cargo-lambda-metadata/src/lambda.rs:166–191  ·  view source on GitHub ↗
(
        &self,
        cmd: &Command,
        arg: Option<&Arg>,
        value: &OsStr,
    )

Source from the content-addressed store, hash-verified

164 type Value = Memory;
165
166 fn parse_ref(
167 &self,
168 cmd: &Command,
169 arg: Option<&Arg>,
170 value: &OsStr,
171 ) -> Result<Self::Value, clap::Error> {
172 let val = value
173 .to_str()
174 .ok_or_else(|| clap::Error::new(clap::error::ErrorKind::InvalidUtf8).with_cmd(cmd))?;
175
176 Memory::from_str(val).map_err(|_| {
177 let mut err = clap::Error::new(clap::error::ErrorKind::ValueValidation).with_cmd(cmd);
178
179 if let Some(arg) = arg {
180 err.insert(
181 ContextKind::InvalidArg,
182 ContextValue::String(arg.to_string()),
183 );
184 }
185
186 let context = ContextValue::String(val.to_string());
187 err.insert(ContextKind::InvalidValue, context);
188
189 err
190 })
191 }
192}
193
194#[derive(Clone, Debug, Default, Display, EnumString, Eq, PartialEq, Serialize)]

Callers

nothing calls this directly

Calls 2

newFunction · 0.85
insertMethod · 0.80

Tested by

no test coverage detected