Skip to content

Conversation

@shawn-willden-ai
Copy link

Add an optional no_std feature that allows lmdb-master-sys to function as a no_std crate in POSIX environments that provide the file I/O syscalls required by LMDB.

Changes:

  • Add no_std feature flag to Cargo.toml
  • Add conditional #![no_std] attribute to lib.rs
  • Replace all ::std::option::Option with ::core::option::Option in bindings.rs

The feature is opt-in and maintains full backwards compatibility. When the no_std feature is not enabled, the crate behaves identically to before. The use of core::option::Option instead of std::option::Option is compatible with both std and no_std environments.

Pull Request

Related issue

Fixes #356

What does this PR do?

  • ...

PR checklist

Please check if your PR fulfills the following requirements:

  • Did you use any AI tool while implementing this PR (code, tests, docs, etc.)? If yes, disclose it in the PR description and describe what it was used for. AI usage is allowed when it is disclosed.
  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines? -- couldn't find them
  • Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

Add an optional no_std feature that allows lmdb-master-sys to function
as a no_std crate in POSIX environments that provide the file I/O
syscalls required by LMDB.

Changes:
- Add no_std feature flag to Cargo.toml
- Add conditional #![no_std] attribute to lib.rs
- Replace all ::std::option::Option with ::core::option::Option in
  bindings.rs

The feature is opt-in and maintains full backwards compatibility. When
the no_std feature is not enabled, the crate behaves identically to
before. The use of core::option::Option instead of std::option::Option
is compatible with both std and no_std environments.
Copy link
Member

@Kerollmops Kerollmops left a comment

Choose a reason for hiding this comment

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

Thank you very much for the proposal, it looks great. However, I think I would also prefer that we update our bindgen usage, so I don't break it when updating the bindings next time.

Also, could you update lmdb-master3-sys, please? Probably the same way.

I am wondering about the complexity to add a CI to make sure I don't break it in the future 🤔

Update bindgen configuration to use .use_core() so future regeneration
of bindings automatically uses core instead of std. This prevents the
no_std support from breaking when bindings are regenerated.

Also apply the same no_std changes to lmdb-master3-sys:
- Add no_std feature flag to Cargo.toml
- Add conditional #![no_std] attribute to lib.rs
- Replace all ::std::option::Option with ::core::option::Option in
  bindings.rs
@shawn-willden-ai
Copy link
Author

shawn-willden-ai commented Feb 2, 2026 via email

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.

lmdb-master-sys no_std support

2 participants