Skip to content

Prepare for 0.9.0 release#185

Closed
nagisa wants to merge 3 commits intomasterfrom
nagisa/nostd-fixups
Closed

Prepare for 0.9.0 release#185
nagisa wants to merge 3 commits intomasterfrom
nagisa/nostd-fixups

Conversation

@nagisa
Copy link
Copy Markdown
Owner

@nagisa nagisa commented Nov 5, 2025

cc @AlexanderSchuetz97 double-check that this works for you.

I ended up nuking a number of AsFilename and AsSymbolName impls still and made the remaining ones terser. We can easily add them back later on in a backwards-compatible manner if it turns out that the current impls don't serve some specific need for some reason or another.

@nagisa nagisa changed the title Nagisa/nostd fixups Prepare for 0.9.0 release Nov 5, 2025
@nagisa nagisa force-pushed the nagisa/nostd-fixups branch 2 times, most recently from 0d0f6ba to 6f25c6f Compare November 5, 2025 14:57
@nagisa
Copy link
Copy Markdown
Owner Author

nagisa commented Nov 5, 2025

Unfortunately the supertrait sealing makes the implementers not visible in the documentation, which I think is crucial to have here. We can explore other options, although at the same time: are these suggestions showing up even when the trait isn't imported? There should rarely be a need for anybody to import the trait.

@nagisa
Copy link
Copy Markdown
Owner Author

nagisa commented Nov 5, 2025

Hm, maybe we could still use super trait and have the methods on it, but instead of having a generic impl<T: SealedTrait> Trait for T, we'd have implementations of Trait for each individual type too... Let me try.

@nagisa
Copy link
Copy Markdown
Owner Author

nagisa commented Nov 5, 2025

Also, why does this showing up in the documentation matter?
The user of libloading should never call these functions, they are something internal to the crate.

That's how you learn about which types you can use to pass in into Library::new or Library::get. One could argue that listing them manually somewhere would be good enough, but nothing really beats being able to click on AsSymbol and finding the following:

image

The internal method does not show up (in fact I especially hid it with doc(hidden) in the sealed method approach.) That said my idea of adjusting supertrait method does also work for doc generation so I'm happy to switch back to supertrait method.

@nagisa nagisa force-pushed the nagisa/nostd-fixups branch 2 times, most recently from 14638bb to 44eb45b Compare November 5, 2025 22:21
* `impl AsSymbolName for &[u16]` hides unconditional allocation (user
  could pass a `&str` or `&[u8]` or `&CStr` instead all of which should
  be more straightforward.
* `impl AsFilename for &[T]` have awkward platform implications. With
  `T = u16` we require that buffer is valid UTF-16, for `T = u8` we
  require that it is UTF-8 but only on Windows. I'm not super
  comfortable with having these types in the cross-platform API
  surface currently. We can explore adding something as a follow-up, but
  for now no-std users will have to live with passing in a `&str`.
* Similarly for `impl AsFilename for CString` family.
* There are a couple of no-std capable tests that sufficiently test the
  functionality of no-std behaviour. For the rest it is fine to require
  that libstd is available. So this removes most of the duplicate no-std
  tests.
@nagisa nagisa force-pushed the nagisa/nostd-fixups branch from 44eb45b to e1416f7 Compare November 5, 2025 22:56
@nagisa nagisa closed this Nov 5, 2025
@nagisa nagisa deleted the nagisa/nostd-fixups branch November 5, 2025 23:15
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.

1 participant