cfg-gate default credential builders so keyring
builds on all platforms
#125
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, I'm currently attempting to use
keyring
for a cross-platform app. One of the platforms (Android) doesn't have a default backend, so I've resorted to stuffing the credentials in the app's data directory for the time being. I've got that alternateCredentialApi
impl built, but sadlykeyring
won't build for android for a small reason: there's nodefault
module.To get around this (but still use the common
keyring
API across all platforms), this PR#[cfg(..)]
gatesbuild_default_credential
,Entry::new
, andEntry::new_with_target
. That way they're only visible on platforms with default backends available. Unsupported platforms will get a compiler error if they try to use the default constructors.Another approach would be to make it a runtime error rather than a compile-time error. Something like:
Otherwise
keyring
is working well for me : )