Commit 6b90391
Artem Kryvokrysenko
Add Alignment::new constructor function
Currently the only way to construct Aligned value is using `aligned::Aligned`
function which returns instance of `Aligned` struct. This does not work well
with type aliases. For example, consider this type alias:
```
/// Aligns value at cache line boundary (assuming 64 byte cache line size)
type CacheLineAligned<T> = Aligned<A64, T>;
```
User still has to use `aligned::Aligned` function to create value which breaks
abstraction provided by type alias:
```
let cache_aligned_value: CacheLineAligned<u32> = aligned::Aligned(42);
```
In this commit I am implementing a conventional `new` constructor for `struct Aligned`
which works with type aliases:
```
let cache_aligned_value = CacheLineAligned::new(42_u32);
```1 parent 10a449d commit 6b90391
1 file changed
+24
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
158 | 172 | | |
159 | 173 | | |
160 | 174 | | |
| |||
525 | 539 | | |
526 | 540 | | |
527 | 541 | | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
528 | 552 | | |
529 | 553 | | |
530 | 554 | | |
| |||
0 commit comments