File: ptr-is-invariant-over-v.rs

package info (click to toggle)
rust-zerocopy 0.8.26-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,748 kB
  • sloc: sh: 116; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 494 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use zerocopy::pointer::{
    invariant::{Aligned, Exclusive, Shared, Valid},
    Ptr,
};

fn _when_exclusive<'big: 'small, 'small>(
    big: Ptr<'small, &'big u32, (Exclusive, Aligned, Valid)>,
    mut _small: Ptr<'small, &'small u32, (Exclusive, Aligned, Valid)>,
) {
    _small = big;
}

fn _when_shared<'big: 'small, 'small>(
    big: Ptr<'small, &'big u32, (Shared, Aligned, Valid)>,
    mut _small: Ptr<'small, &'small u32, (Shared, Aligned, Valid)>,
) {
    _small = big;
}

fn main() {}