0
我認爲這可能會工作,如果我可以制定終生符號,我錯了嗎?我可以針對實現Pattern的泛型類型創建匹配嗎?
pub fn from<T:Pattern>(from: T) -> Result<Tag, &'static str> {
match from {
'A'|"A" => Ok(Tag::ChA),
'B'|"B" => Ok(Tag::ChB),
'C'|"C" => Ok(Tag::ChC),
'D'|"D" => Ok(Tag::ChD),
'T'|"Tmpr" => Ok(Tag::Tmpr),
'Y'|"Batt" => Ok(Tag::Batt),
'L'|"Acc" => Ok(Tag::Acc),
_ => Err("Error: unknown channel"),
}
}