Skip to content

Commit 64b10ed

Browse files
committed
Add steal() for each peripheral
1 parent 062d0b9 commit 64b10ed

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
1010
- removed register writer & reader wrappers, generic `REG` in field writers (#731)
1111
- Updated syn to version 2 (#732)
1212
- Let readable field fetch doc from svd description (#734)
13+
- Add `steal()` for each peripheral
1314

1415
## [v0.29.0] - 2023-06-05
1516

src/generate/peripheral.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ pub fn render(p_original: &Peripheral, index: &Index, config: &Config) -> Result
9191
pub const fn ptr() -> *const #base::RegisterBlock {
9292
Self::PTR
9393
}
94+
95+
pub unsafe fn steal(&self) -> Self {
96+
Self { _marker: PhantomData }
97+
}
9498
}
9599

96100
#feature_attribute_n
@@ -150,6 +154,10 @@ pub fn render(p_original: &Peripheral, index: &Index, config: &Config) -> Result
150154
pub const fn ptr() -> *const #base::RegisterBlock {
151155
Self::PTR
152156
}
157+
158+
pub unsafe fn steal(&self) -> Self {
159+
Self { _marker: PhantomData }
160+
}
153161
}
154162

155163
#feature_attribute

0 commit comments

Comments
 (0)