Skip to main content

create

Function create 

Source
pub fn create<T: Safe, P: AsRef<Path>>(path: P, size: usize) -> Result<Owned<T>>
Expand description

Create a new array of the given type and size as a shared object.

Examples found in repository?
examples/writer.rs (line 18)
12fn main() {
13	let mut foo = shmem::create::<Foo, _>("shmem-rust-test").unwrap();
14
15	foo.bar = 23;
16	foo.baz = 42;
17
18	let mut bar = shmem::array::create::<u8, _>("shmem-rust-test-array", 10).unwrap();
19	for (i, item) in bar.iter_mut().enumerate() {
20		*item = i as u8;
21	}
22
23	thread::sleep(Duration::from_secs(5));
24}