B:BD[
2.830] → [
2.830:1483]
pub(crate) fn played_as(val: SteelVal) -> Result<Self, String> {
if let Some(sym) = val.as_symbol() {
match sym.to_ascii_lowercase().as_str() {
"magister" => Ok(Self::PlayedAs(PlayedAs::Magister)),
"aide" => Ok(Self::PlayedAs(PlayedAs::Aide)),
"fragment" => Ok(Self::PlayedAs(PlayedAs::Fragment { is_set: false })),
"set-fragment" => Ok(Self::PlayedAs(PlayedAs::Fragment { is_set: true })),
_ => Err(format!("invalid played-as specifier: {}", sym)),
}
} else {
Err(format!("expected symbol as input, found {}", val))
pub(crate) fn played_as(val: SteelVal) -> Result<Self, SteelErr> {
let sym = val.symbol_or_else(|| {
SteelErr::new(
rerrs::ErrorKind::TypeMismatch,
format!("expected symbol, found {}", val),
)
})?;
match sym.to_ascii_lowercase().as_str() {
"magister" => Ok(Self::PlayedAs(PlayedAs::Magister)),
"aide" => Ok(Self::PlayedAs(PlayedAs::Aide)),
"fragment" => Ok(Self::PlayedAs(PlayedAs::Fragment { is_set: false })),
"set-fragment" => Ok(Self::PlayedAs(PlayedAs::Fragment { is_set: true })),
_ => Err(SteelErr::new(rerrs::ErrorKind::Generic, format!("invalid spec, expected one of ['magister, 'aide, 'fragment, 'set-fragment], found '{}", sym))),