Skip to content

Commit

Permalink
docs, strict mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mscroggs committed Nov 19, 2024
1 parent 15cab81 commit 45e60a8
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
5 changes: 0 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

workspace = { members = ["c-api-tools-macros", "example_project"] }

[features]
Expand All @@ -25,13 +24,9 @@ name = "c_api_tools"
crate-type = ["lib", "cdylib"]

[dependencies]
itertools = "0.13.*"
num = "0.4"
c-api-tools-macros = { path = "./c-api-tools-macros" }

[dev-dependencies]
paste = "1.*"

[build-dependencies]
cbindgen = "0.27.0"

Expand Down
7 changes: 7 additions & 0 deletions c-api-tools-macros/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
//! C API tools macros
#![cfg_attr(feature = "strict", deny(warnings), deny(unused_crate_dependencies))]
#![warn(missing_docs)]

mod attribute_c_wrappers;
mod attribute_concretise_types;
mod eval_concrete_type;
Expand All @@ -7,16 +11,19 @@ use attribute_concretise_types::concretise_type_impl;
use eval_concrete_type::eval_with_concrete_type_impl;
use proc_macro::TokenStream;

/// Evaluate iwth concrete type
#[proc_macro]
pub fn eval_with_concrete_type(item: TokenStream) -> TokenStream {
eval_with_concrete_type_impl(item)
}

/// C functions
#[proc_macro_attribute]
pub fn cfuncs(args: TokenStream, item: TokenStream) -> TokenStream {
c_wrapper_impl(args, item)
}

/// Concretise types
#[proc_macro_attribute]
pub fn concretise_types(args: TokenStream, item: TokenStream) -> TokenStream {
concretise_type_impl(args, item)
Expand Down
4 changes: 4 additions & 0 deletions example_project/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
//! Example project
#![cfg_attr(feature = "strict", deny(warnings), deny(unused_crate_dependencies))]
#![warn(missing_docs)]

use std::fmt::Display;

pub use c_api_tools::cfuncs;
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
//! C API tools
#![cfg_attr(feature = "strict", deny(warnings), deny(unused_crate_dependencies))]
#![warn(missing_docs)]

mod types;

pub use c_api_tools_macros::cfuncs;
Expand Down
13 changes: 12 additions & 1 deletion src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,31 @@
#[derive(Debug, Clone, Copy, PartialEq)]
#[repr(u8)]
pub enum DType {
/// Float 32
F32,
/// Float 64
F64,
/// Complex 32
C32,
/// Complex 64
C64,
/// Unsigned int 8
U8,
/// Unsigned int 32
U32,
/// Unsigned int 64
U64,
/// Int 8
I8,
/// Int 32
I32,
/// Int 64
I64,
}

/// Return runtime numeric type information.
/// Runtime numeric type information.
pub trait DTypeIdentifier {
/// Return runtime numeric type information.
fn dtype() -> DType;
}

Expand Down

0 comments on commit 45e60a8

Please sign in to comment.