pub struct OpenOptions { /* private fields */ }Expand description
Flags and parameters which control how a PosixMq
message queue is opened or created.
Implementations§
Source§impl OpenOptions
impl OpenOptions
Sourcepub fn mode(&mut self, mode: u32) -> &mut Self
pub fn mode(&mut self, mode: u32) -> &mut Self
Set permissions to create the queue with.
Some bits might be cleared by the process’s umask when creating the queue, and unknown bits are ignored.
This field is ignored if the queue already exists or should not be created. If this method is not called, queues are created with mode 600.
Sourcepub fn max_msg_len(&mut self, max_msg_len: usize) -> &mut Self
pub fn max_msg_len(&mut self, max_msg_len: usize) -> &mut Self
Set the maximum size of each message.
recv() will fail if given a buffer smaller than this value.
If max_msg_len and capacity are both zero (or not set), the queue
will be created with a maximum length and capacity decided by the
operating system.
If this value is specified, capacity should also be, or opening the
message queue might fail.
Sourcepub fn capacity(&mut self, capacity: usize) -> &mut Self
pub fn capacity(&mut self, capacity: usize) -> &mut Self
Set the maximum number of messages in the queue.
When the queue is full, further send()s will either block
or fail with an error of type ErrorKind::WouldBlock.
If both capacity and max_msg_len are zero (or not set), the queue
will be created with a maximum length and capacity decided by the
operating system.
If this value is specified, max_msg_len should also be, or opening the
message queue might fail.
Sourcepub fn create_new(&mut self) -> &mut Self
pub fn create_new(&mut self) -> &mut Self
Create a new queue, failing if the queue already exists.
Sourcepub fn existing(&mut self) -> &mut Self
pub fn existing(&mut self) -> &mut Self
Require the queue to already exist, failing if it doesn’t.
Sourcepub fn nonblocking(&mut self) -> &mut Self
pub fn nonblocking(&mut self) -> &mut Self
Open the message queue in non-blocking mode.
This must be done if you want to use the message queue with mio.
Sourcepub fn open<N: AsRef<[u8]> + ?Sized>(&self, name: &N) -> Result<PosixMq, Error>
pub fn open<N: AsRef<[u8]> + ?Sized>(&self, name: &N) -> Result<PosixMq, Error>
Open a queue with the specified options.
If the name doesn’t start with a ‘/’, one will be prepended.
§Errors
- Queue doesn’t exist (ENOENT) =>
ErrorKind::NotFound - Name is just “/” (ENOENT) or is empty =>
ErrorKind::NotFound - Queue already exists (EEXISTS) =>
ErrorKind::AlreadyExists - Not permitted to open in this mode (EACCESS) =>
ErrorKind::PermissionDenied - More than one ‘/’ in name (EACCESS) =>
ErrorKind::PermissionDenied - Invalid capacities (EINVAL) =>
ErrorKind::InvalidInput - Capacities too high (EMFILE) =>
ErrorKind::Other - Posix message queues are disabled (ENOSYS) =>
ErrorKind::Other - Name contains ‘\0’ =>
ErrorKind::InvalidInput - Name is too long (ENAMETOOLONG) =>
ErrorKind::Other - Unlikely (ENFILE, EMFILE, ENOMEM, ENOSPC) =>
ErrorKind::Other - Possibly other
Sourcepub fn open_c(&self, name: &CStr) -> Result<PosixMq, Error>
pub fn open_c(&self, name: &CStr) -> Result<PosixMq, Error>
Open a queue with the specified options and without inspecting name
or allocating.
This can on NetBSD be used to access message queues with names that doesn’t start with a ‘/’.
§Errors
- Queue doesn’t exist (ENOENT) =>
ErrorKind::NotFound - Name is just “/” (ENOENT) =>
ErrorKind::NotFound - Queue already exists (EEXISTS) =>
ErrorKind::AlreadyExists - Not permitted to open in this mode (EACCESS) =>
ErrorKind::PermissionDenied - More than one ‘/’ in name (EACCESS) =>
ErrorKind::PermissionDenied - Invalid capacities (EINVAL) =>
ErrorKind::InvalidInput - Posix message queues are disabled (ENOSYS) =>
ErrorKind::Other - Name is empty (EINVAL) =>
ErrorKind::InvalidInput - Name is too long (ENAMETOOLONG) =>
ErrorKind::Other - Unlikely (ENFILE, EMFILE, ENOMEM, ENOSPC) =>
ErrorKind::Other - Possibly other
Trait Implementations§
Source§impl Clone for OpenOptions
impl Clone for OpenOptions
Source§fn clone(&self) -> OpenOptions
fn clone(&self) -> OpenOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more