pub struct EventsRegion { /* private fields */ }Expand description
File-backed shared events region (SPSC + MPSC).
Creator/joiner behavior:
- If the backing file is new/empty, the first opener initializes the layout.
- If another process is initializing, openers wait until
initialized == 2. - Joiners validate the v1 header, claimed layout size, and requested capabilities.
Implementations§
Source§impl EventsRegion
impl EventsRegion
Sourcepub fn open(name: &str) -> Result<Self, Error>
pub fn open(name: &str) -> Result<Self, Error>
Open (or create) an events region using the default path for name.
Sourcepub fn open_with(name: &str, options: OpenOptions) -> Result<Self, Error>
pub fn open_with(name: &str, options: OpenOptions) -> Result<Self, Error>
Open (or create) an events region using explicit options.
Sourcepub fn open_path(path: impl AsRef<Path>) -> Result<Self, Error>
pub fn open_path(path: impl AsRef<Path>) -> Result<Self, Error>
Open (or create) an events region backed by path.
Sourcepub fn open_path_with(
path: impl AsRef<Path>,
options: OpenOptions,
) -> Result<Self, Error>
pub fn open_path_with( path: impl AsRef<Path>, options: OpenOptions, ) -> Result<Self, Error>
Open (or create) an events region backed by path with explicit options.
§Errors
Returns:
Error::Ioon filesystem/mapping failuresError::Misalignedif the mapping base address does not meet the ABI alignmentError::RegionTooSmallif the mapped file is smaller than the layout claimsError::Layoutif the region is uninitialized or incompatible (wrong options/caps)
Sourcepub fn as_ptr(&self) -> *mut SharedLayout
pub fn as_ptr(&self) -> *mut SharedLayout
Get the raw layout pointer for this mapping.
The pointer is valid as long as the EventsRegion is alive.
Sourcepub fn split_spsc(&mut self) -> Result<(SpscSender, SpscReceiver), Error>
pub fn split_spsc(&mut self) -> Result<(SpscSender, SpscReceiver), Error>
Split the region into an SPSC sender/receiver pair.
This validates the mapping header before constructing the handles.
Sourcepub fn split_mpsc(&mut self) -> Result<(MpscProducer, MpscConsumer), Error>
pub fn split_mpsc(&mut self) -> Result<(MpscProducer, MpscConsumer), Error>
Split the region into an MPSC producer/consumer pair.
This validates the mapping header before constructing the handles.
Trait Implementations§
impl Send for EventsRegion
impl Sync for EventsRegion
Auto Trait Implementations§
impl Freeze for EventsRegion
impl !RefUnwindSafe for EventsRegion
impl Unpin for EventsRegion
impl !UnwindSafe for EventsRegion
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