Skip to content

Commit

Permalink
feat: Implement JanetArgs for [Janet; N]
Browse files Browse the repository at this point in the history
  • Loading branch information
GrayJack committed Apr 22, 2024
1 parent e01f7b9 commit e3dc106
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1917,6 +1917,21 @@ impl JanetArgs for [Janet] {
}
}

impl<const N: usize> JanetArgs for [Janet; N] {
#[inline]
fn get_value(&self, index: usize) -> Option<Janet> {
self.get(index).copied()
}

#[inline]
fn get_tagged(&self, index: usize) -> Option<TaggedJanet> {
self.get(index).map(|j| j.unwrap())
}
}

// FIXME: Implement for `JanetTuple` and `JanetArray` once internally they start to use
// `usize` (`size_t`)

/// Trait defining the name of the type known to Janet
pub trait JanetTypeName {
/// Returns a string with the name of the type
Expand Down

0 comments on commit e3dc106

Please sign in to comment.