mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-09 22:58:01 +00:00
Get DeriveBuiltin from symbol
This commit is contained in:
parent
44984d289c
commit
61d34a4225
2 changed files with 19 additions and 4 deletions
|
@ -65,6 +65,18 @@ pub enum DeriveBuiltin {
|
|||
Decoder,
|
||||
}
|
||||
|
||||
impl TryFrom<Symbol> for DeriveBuiltin {
|
||||
type Error = Symbol;
|
||||
|
||||
fn try_from(value: Symbol) -> Result<Self, Self::Error> {
|
||||
match value {
|
||||
Symbol::ENCODE_TO_ENCODER => Ok(DeriveBuiltin::ToEncoder),
|
||||
Symbol::DECODE_DECODER => Ok(DeriveBuiltin::Decoder),
|
||||
_ => Err(value),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Derived {
|
||||
pub fn builtin(
|
||||
builtin: DeriveBuiltin,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue