Skip to content

Make cf-mach a lib - #63

Merged
HenriqueSFernandes merged 2 commits into
cloudflare:mainfrom
bim9262:enable_lib_use
Sep 24, 2026
Merged

HenriqueSFernandes merged 2 commits into
cloudflare:mainfrom
bim9262:enable_lib_use

Conversation

@bim9262

@bim9262 bim9262 commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Allow this to be used by other projects by making cf-mach a library.

For example: greshake/i3status-rust#2248

Related to: #38

@HenriqueSFernandes

Copy link
Copy Markdown
Collaborator

Just a question, do you need all of them or could we scope lib.rs to only the engine modules?

pub mod nq_core;
pub mod nq_latency;
pub mod nq_load_generator;
pub mod nq_packetloss;
pub mod nq_rpm;
pub mod nq_stats;
pub mod nq_tokio_network;

Then main.rs could replace its mod nq_*; declarations with:

use cf_mach::{nq_core, nq_latency, nq_load_generator, nq_packetloss, nq_rpm, nq_tokio_network};

to avoid double compilation.

And maybe a short sentence on README.md to inform that although it can be used as a library it may not be stable and may change between versions.

Let me know your thoughts on this!

@bim9262

bim9262 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

That sounds good! I've just updated the PR accordingly.

@HenriqueSFernandes HenriqueSFernandes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thank you!

@HenriqueSFernandes
HenriqueSFernandes merged commit bf8a71c into cloudflare:main Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants