pub struct NativeMemoryCapabilities { /* private fields */ }Expand description
Cross-platform capabilities of the selected native backend.
Implementations§
Source§impl NativeMemoryCapabilities
impl NativeMemoryCapabilities
Sourcepub const fn platform(self) -> NativePlatform
pub const fn platform(self) -> NativePlatform
Selected operating-system backend.
Examples found in repository?
examples/common_memory.rs (line 17)
5fn main() -> Result<(), Box<dyn std::error::Error>> {
6 let capabilities = native_memory_capabilities();
7 let options = RegionOptions::growable(128, 4096, WriterOwner::Creator);
8 let mut region = NativeRegion::allocate(options)?;
9
10 region.initialize(|bytes| bytes[..8].copy_from_slice(b"NIPCDEMO"));
11 region.grow(512)?;
12 region.initialize(|bytes| assert_eq!(&bytes[..8], b"NIPCDEMO"));
13
14 let status = region.status();
15 println!(
16 "backend={:?} authority={:?} logical={} mapped={} maximum={}",
17 capabilities.platform(),
18 capabilities.authority_mechanism(),
19 status.logical_len,
20 status.mapped_len,
21 status.maximum_len,
22 );
23
24 region.clear();
25 region.initialize(|bytes| bytes[..8].copy_from_slice(b"REUSABLE"));
26
27 // `destroy` explicitly clears the complete mapping before releasing it.
28 // Use `prepare_for_sharing` instead when handing the region to the
29 // authenticated platform transfer typestate.
30 region.destroy();
31 Ok(())
32}Sourcepub const fn architecture(self) -> NativeArchitecture
pub const fn architecture(self) -> NativeArchitecture
Selected processor architecture.
Native mechanism used to freeze or attenuate authority.
Examples found in repository?
examples/common_memory.rs (line 18)
5fn main() -> Result<(), Box<dyn std::error::Error>> {
6 let capabilities = native_memory_capabilities();
7 let options = RegionOptions::growable(128, 4096, WriterOwner::Creator);
8 let mut region = NativeRegion::allocate(options)?;
9
10 region.initialize(|bytes| bytes[..8].copy_from_slice(b"NIPCDEMO"));
11 region.grow(512)?;
12 region.initialize(|bytes| assert_eq!(&bytes[..8], b"NIPCDEMO"));
13
14 let status = region.status();
15 println!(
16 "backend={:?} authority={:?} logical={} mapped={} maximum={}",
17 capabilities.platform(),
18 capabilities.authority_mechanism(),
19 status.logical_len,
20 status.mapped_len,
21 status.maximum_len,
22 );
23
24 region.clear();
25 region.initialize(|bytes| bytes[..8].copy_from_slice(b"REUSABLE"));
26
27 // `destroy` explicitly clears the complete mapping before releasing it.
28 // Use `prepare_for_sharing` instead when handing the region to the
29 // authenticated platform transfer typestate.
30 region.destroy();
31 Ok(())
32}Sourcepub const fn supports_replacement_growth(self) -> bool
pub const fn supports_replacement_growth(self) -> bool
Whether a private region can grow by allocating a replacement mapping.
Sourcepub const fn supports_in_place_growth(self) -> bool
pub const fn supports_in_place_growth(self) -> bool
Whether a shared mapping can grow in place.
Whether permission changes are accepted after sharing.
Sourcepub const fn releases_on_drop(self) -> bool
pub const fn releases_on_drop(self) -> bool
Whether dropping all owners automatically releases the anonymous object.
Trait Implementations§
Source§impl Clone for NativeMemoryCapabilities
impl Clone for NativeMemoryCapabilities
Source§fn clone(&self) -> NativeMemoryCapabilities
fn clone(&self) -> NativeMemoryCapabilities
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for NativeMemoryCapabilities
Source§impl Debug for NativeMemoryCapabilities
impl Debug for NativeMemoryCapabilities
impl Eq for NativeMemoryCapabilities
Source§impl PartialEq for NativeMemoryCapabilities
impl PartialEq for NativeMemoryCapabilities
impl StructuralPartialEq for NativeMemoryCapabilities
Auto Trait Implementations§
impl Freeze for NativeMemoryCapabilities
impl RefUnwindSafe for NativeMemoryCapabilities
impl Send for NativeMemoryCapabilities
impl Sync for NativeMemoryCapabilities
impl Unpin for NativeMemoryCapabilities
impl UnsafeUnpin for NativeMemoryCapabilities
impl UnwindSafe for NativeMemoryCapabilities
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more