Skip to content

Commit

Permalink
Add back on_gba
Browse files Browse the repository at this point in the history
  • Loading branch information
ischeinkman committed Aug 21, 2024
1 parent 4cbf673 commit 0aeb291
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ edition = "2021"
license = "Zlib OR Apache-2.0 OR MIT"

[features]
default = ["on_gba"]
# SEE THE CRATE DOCS FOR SAFETY RELATED INFO REGARDING THIS FEATURE.
on_gba = []
# utilize `doc_cfg` where appropriate. requires nightly. intended mostly for use
# during docs.rs documentation generation.
doc_cfg = []
# Activates the `track_caller` attribute on various functions. Use of the
# `track_caller` attribute on a function adds a "secret" extra argument for the
# `Location` of the caller, which can reduce performance if the function is not
Expand All @@ -19,3 +25,4 @@ track_caller = []
# on the GBA. This is the closest target that docs.rs supports by default and
# which *also* supports the `instruction_set` attribute to avoid build errors.
targets = ["armv5te-unknown-linux-gnueabi"]
features = ["doc_cfg"]
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ unsafe impl<T> GbaCellSafe for T where T: Copy {}
#[repr(transparent)]
pub struct GbaCell<T>(core::cell::UnsafeCell<T>);

#[cfg(feature = "on_gba")]
impl<T> Debug for GbaCell<T>
where
T: GbaCellSafe + Debug,
Expand All @@ -53,6 +54,7 @@ where
Self::new(T::default())
}
}
#[cfg(feature = "on_gba")]
impl<T> Clone for GbaCell<T>
where
T: GbaCellSafe + Default,
Expand All @@ -64,6 +66,7 @@ where
}
}

#[cfg(feature = "on_gba")]
unsafe impl<T> Sync for GbaCell<T> {}

impl<T> GbaCell<T>
Expand Down Expand Up @@ -93,6 +96,7 @@ where
/// Read the value in the cell.
#[inline]
#[must_use]
#[cfg(feature = "on_gba")]
#[cfg_attr(feature = "track_caller", track_caller)]
pub fn read(&self) -> T {
// SAFETY: Guranteed to meet the size & alignment requirements of the
Expand All @@ -102,6 +106,7 @@ where

/// Writes a new value to the cell.
#[inline]
#[cfg(feature = "on_gba")]
#[cfg_attr(feature = "track_caller", track_caller)]
pub fn write(&self, t: T) {
// SAFETY: Guranteed to meet the size & alignment requirements of the
Expand Down

0 comments on commit 0aeb291

Please sign in to comment.