Skip to content

Commit

Permalink
Explain running compat checks locally
Browse files Browse the repository at this point in the history
  • Loading branch information
fasterthanlime committed Sep 17, 2024
1 parent 2929a1a commit 18e99b9
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions rubicon/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,34 @@ macro_rules! compatibility_check {
/// │ Run `cargo tree -i mokio -e features` from both. │
/// └───────────────────────────────────────────────────────┘
/// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
///
/// # Running compatibility checks manually
///
/// Sometimes, you might want to check for ABI compatibility but you might not have
/// any thread-local or process-local that `rubicon` could sneak a compatibility check into.
///
/// In that case, you can run the compatibility check manually. Maybe you can sneak
/// it into a `Deref` impl, something like that:
///
/// ```rust,ignore
/// rubicon::compatibility_check! {
/// ("version", env!("CARGO_PKG_VERSION")),
/// // etc.
/// }
///
/// pub struct MySuperWrapperType(String);
///
/// impl Deref for MySuperWrapperType {
/// type Target = MySuperType;
///
/// fn deref(&self) -> &Self::Target {
/// // this is a good time to run compatibility checks
/// #[cfg(not(feature = "no-compatibility-checks-yolo"))]
/// crate::compatibility_check_once();
///
/// &self.0
/// }
/// }
/// ```

#[cfg(not(any(feature = "export-globals", feature = "import-globals")))]
Expand Down

0 comments on commit 18e99b9

Please sign in to comment.