Skip to content

Commit

Permalink
Add new feature flag to test matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
kjvalencik committed Jul 16, 2024
1 parent 3cfbd7a commit b209a95
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
17 changes: 15 additions & 2 deletions crates/neon/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,21 @@ pub struct Exports(());
impl Exports {
/// Export all values exported with [`neon::export`](export)
///
/// ```ignore
/// ```
/// # fn main() {
/// # use neon::prelude::*;
/// #[neon::main]
/// fn main(mut cx: ModuleContext) -> NeonResult<()> {
/// neon::registered().export(&mut cx)?;
/// Ok(())
/// }
/// # }
/// ```
///
/// For more control, iterate over exports.
///
/// ```ignore
/// ```
/// # fn main() {
/// # use neon::prelude::*;
/// #[neon::main]
/// fn main(mut cx: ModuleContext) -> NeonResult<()> {
Expand All @@ -201,6 +204,7 @@ impl Exports {
///
/// Ok(())
/// }
/// # }
/// ```
pub fn export(self, cx: &mut ModuleContext) -> NeonResult<()> {
for create in self {
Expand Down Expand Up @@ -238,6 +242,7 @@ fn feature_matrix() {
const EXTERNAL_BUFFERS: &str = "external-buffers";
const FUTURES: &str = "futures";
const SERDE: &str = "serde";
const TOKIO: &str = "tokio";
const NODE_API_VERSIONS: &[&str] = &[
"napi-1", "napi-2", "napi-3", "napi-4", "napi-5", "napi-6", "napi-7", "napi-8",
];
Expand All @@ -249,10 +254,18 @@ fn feature_matrix() {
&[EXTERNAL_BUFFERS],
&[FUTURES],
&[SERDE],
&[TOKIO],
&[EXTERNAL_BUFFERS, FUTURES],
&[EXTERNAL_BUFFERS, SERDE],
&[EXTERNAL_BUFFERS, TOKIO],
&[FUTURES, SERDE],
&[FUTURES, TOKIO],
&[SERDE, TOKIO],
&[EXTERNAL_BUFFERS, FUTURES, SERDE],
&[EXTERNAL_BUFFERS, FUTURES, TOKIO],
&[EXTERNAL_BUFFERS, SERDE, TOKIO],
&[FUTURES, SERDE, TOKIO],
&[EXTERNAL_BUFFERS, FUTURES, SERDE, TOKIO],
];

let cargo = env::var_os("CARGO").unwrap_or_else(|| "cargo".into());
Expand Down
4 changes: 2 additions & 2 deletions crates/neon/src/sys/bindings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ macro_rules! napi_name {
///
/// Sample input:
///
/// ```ignore
/// ```skip
/// extern "C" {
/// fn get_undefined(env: Env, result: *mut Value) -> Status;
/// /* Additional functions may be included */
Expand All @@ -48,7 +48,7 @@ macro_rules! napi_name {
///
/// Generated output:
///
/// ```ignore
/// ```skip
/// // Each field is a pointer to a N-API function
/// struct Napi {
/// get_undefined: unsafe extern "C" fn(env: Env, result: *mut Value) -> Status,
Expand Down
2 changes: 1 addition & 1 deletion crates/neon/src/types_impl/buffer/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ where
/// Note that, depending on the element size, this is not necessarily the same as
/// [`size()`](crate::types::buffer::TypedArray::size). In particular:
///
/// ```ignore
/// ```skip
/// self.size() == self.len() * size_of::<T>()
/// ```
#[allow(clippy::len_without_is_empty)]
Expand Down
3 changes: 3 additions & 0 deletions crates/neon/src/types_impl/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ use crate::{
/// [`SystemTime`](std::time::SystemTime) timestamps to JavaScript `Date` objects.
///
/// ```
/// # #[cfg(feature = "easy-cast")]
/// # {
/// # use neon::prelude::*;
/// use easy_cast::Cast; // for safe numeric conversions
/// use neon::types::JsDate;
Expand All @@ -45,6 +47,7 @@ use crate::{
/// .and_then(|n| Ok(cx.date(n)?))
/// .or_else(|err| cx.throw_error(err.to_string()))
/// }
/// # }
/// ```
#[cfg_attr(docsrs, doc(cfg(feature = "napi-5")))]
#[derive(Debug)]
Expand Down

0 comments on commit b209a95

Please sign in to comment.