Status

Struct Status 

Source
pub struct Status(/* private fields */);
Expand description

Status type indicating the result of a Fuchsia syscall.

This type is generally used to indicate the reason for an error. While this type can contain Status::OK (ZX_OK in C land), elements of this type are generally constructed using the ok method, which checks for ZX_OK and returns a Result<(), Status> appropriately.

Implementations§

Source§

impl Status

Source

pub fn ok(raw: zx_status_t) -> Result<(), Status>

Returns Ok(()) if the status was OK, otherwise returns Err(status).

Source

pub fn from_raw(raw: zx_status_t) -> Self

Source

pub fn into_raw(self) -> zx_status_t

Source§

impl Status

Source

pub const OK: Status

Indicates an operation was successful.

Source

pub const INTERNAL: Status

The system encountered an otherwise unspecified error while performing the operation.

Source

pub const NOT_SUPPORTED: Status

The operation is not implemented, supported, or enabled.

Source

pub const NO_RESOURCES: Status

The system was not able to allocate some resource needed for the operation.

Source

pub const NO_MEMORY: Status

The system was not able to allocate memory needed for the operation.

Source

pub const INTERRUPTED_RETRY: Status

The system call was interrupted, but should be retried. This should not be seen outside of the VDSO.

Source

pub const INVALID_ARGS: Status

An argument is invalid. For example, a null pointer when a null pointer is not permitted.

Source

pub const BAD_HANDLE: Status

A specified handle value does not refer to a handle.

Source

pub const WRONG_TYPE: Status

The subject of the operation is the wrong type to perform the operation.

For example: Attempting a message_read on a thread handle.

Source

pub const BAD_SYSCALL: Status

The specified syscall number is invalid.

Source

pub const OUT_OF_RANGE: Status

An argument is outside the valid range for this operation.

Source

pub const BUFFER_TOO_SMALL: Status

The caller-provided buffer is too small for this operation.

Source

pub const BAD_STATE: Status

The operation failed because the current state of the object does not allow it, or a precondition of the operation is not satisfied.

Source

pub const TIMED_OUT: Status

The time limit for the operation elapsed before the operation completed.

Source

pub const SHOULD_WAIT: Status

The operation cannot be performed currently but potentially could succeed if the caller waits for a prerequisite to be satisfied, like waiting for a handle to be readable or writable.

Example: Attempting to read from a channel that has no messages waiting but has an open remote will return ZX_ERR_SHOULD_WAIT. In contrast, attempting to read from a channel that has no messages waiting and has a closed remote end will return ZX_ERR_PEER_CLOSED.

Source

pub const CANCELED: Status

The in-progress operation, for example, a wait, has been canceled.

Source

pub const PEER_CLOSED: Status

The operation failed because the remote end of the subject of the operation was closed.

Source

pub const NOT_FOUND: Status

The requested entity is not found.

Source

pub const ALREADY_EXISTS: Status

An object with the specified identifier already exists.

Example: Attempting to create a file when a file already exists with that name.

Source

pub const ALREADY_BOUND: Status

The operation failed because the named entity is already owned or controlled by another entity. The operation could succeed later if the current owner releases the entity.

Source

pub const UNAVAILABLE: Status

The subject of the operation is currently unable to perform the operation.

This is used when there’s no direct way for the caller to observe when the subject will be able to perform the operation and should thus retry.

Source

pub const ACCESS_DENIED: Status

The caller did not have permission to perform the specified operation.

Source

pub const IO: Status

Otherwise-unspecified error occurred during I/O.

Source

pub const IO_REFUSED: Status

The entity the I/O operation is being performed on rejected the operation.

Example: an I2C device NAK’ing a transaction or a disk controller rejecting an invalid command, or a stalled USB endpoint.

Source

pub const IO_DATA_INTEGRITY: Status

The data in the operation failed an integrity check and is possibly corrupted.

Example: CRC or Parity error.

Source

pub const IO_DATA_LOSS: Status

The data in the operation is currently unavailable and may be permanently lost.

Example: A disk block is irrecoverably damaged.

Source

pub const IO_NOT_PRESENT: Status

The device is no longer available (has been unplugged from the system, powered down, or the driver has been unloaded).

Source

pub const IO_OVERRUN: Status

More data was received from the device than expected.

Example: a USB “babble” error due to a device sending more data than the host queued to receive.

Source

pub const IO_MISSED_DEADLINE: Status

An operation did not complete within the required timeframe.

Example: A USB isochronous transfer that failed to complete due to an overrun or underrun.

Source

pub const IO_INVALID: Status

The data in the operation is invalid parameter or is out of range.

Example: A USB transfer that failed to complete with TRB Error

Source

pub const BAD_PATH: Status

Path name is too long.

Source

pub const NOT_DIR: Status

The object is not a directory or does not support directory operations.

Example: Attempted to open a file as a directory or attempted to do directory operations on a file.

Source

pub const NOT_FILE: Status

Object is not a regular file.

Source

pub const FILE_BIG: Status

This operation would cause a file to exceed a filesystem-specific size limit.

Source

pub const NO_SPACE: Status

The filesystem or device space is exhausted.

Source

pub const NOT_EMPTY: Status

The directory is not empty for an operation that requires it to be empty.

For example, non-recursively deleting a directory with files still in it.

Source

pub const STOP: Status

An indicate to not call again.

The flow control values ZX_ERR_STOP, ZX_ERR_NEXT, and ZX_ERR_ASYNC are not errors and will never be returned by a system call or public API. They allow callbacks to request their caller perform some other operation.

For example, a callback might be called on every event until it returns something other than ZX_OK. This status allows differentiation between “stop due to an error” and “stop because work is done.”

Source

pub const NEXT: Status

Advance to the next item.

The flow control values ZX_ERR_STOP, ZX_ERR_NEXT, and ZX_ERR_ASYNC are not errors and will never be returned by a system call or public API. They allow callbacks to request their caller perform some other operation.

For example, a callback could use this value to indicate it did not consume an item passed to it, but by choice, not due to an error condition.

Source

pub const ASYNC: Status

Ownership of the item has moved to an asynchronous worker.

The flow control values ZX_ERR_STOP, ZX_ERR_NEXT, and ZX_ERR_ASYNC are not errors and will never be returned by a system call or public API. They allow callbacks to request their caller perform some other operation.

Unlike ZX_ERR_STOP, which implies that iteration on an object should stop, and ZX_ERR_NEXT, which implies that iteration should continue to the next item, ZX_ERR_ASYNC implies that an asynchronous worker is responsible for continuing iteration.

For example, a callback will be called on every event, but one event needs to handle some work asynchronously before it can continue. ZX_ERR_ASYNC implies the worker is responsible for resuming iteration once its work has completed.

Source

pub const PROTOCOL_NOT_SUPPORTED: Status

The specified protocol is not supported.

Source

pub const ADDRESS_UNREACHABLE: Status

The host is unreachable.

Source

pub const ADDRESS_IN_USE: Status

Address is being used by someone else.

Source

pub const NOT_CONNECTED: Status

The socket is not connected.

Source

pub const CONNECTION_REFUSED: Status

The remote peer rejected the connection.

Source

pub const CONNECTION_RESET: Status

The connection was reset.

Source

pub const CONNECTION_ABORTED: Status

The connection was aborted.

Source§

impl Status

Source

pub fn into_io_error(self) -> Error

Source

pub fn from_result(res: Result<(), Self>) -> Self

Trait Implementations§

Source§

impl Clone for Status

Source§

fn clone(&self) -> Status

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Status

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Status

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for Status

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for Status

Source§

fn from(err: Error) -> Status

Converts to this type from the input type.
Source§

impl From<ErrorKind> for Status

Source§

fn from(kind: ErrorKind) -> Self

Converts to this type from the input type.
Source§

impl From<NulError> for Status

Source§

fn from(_error: NulError) -> Status

Converts to this type from the input type.
Source§

impl From<Result<(), Status>> for Status

Source§

fn from(res: Result<(), Status>) -> Status

Converts to this type from the input type.
Source§

impl From<Status> for Error

Source§

fn from(status: Status) -> Error

Converts to this type from the input type.
Source§

impl From<Status> for ErrorKind

Source§

fn from(status: Status) -> ErrorKind

Converts to this type from the input type.
Source§

impl From<Status> for Result<(), Status>

Source§

fn from(src: Status) -> Result<(), Status>

Converts to this type from the input type.
Source§

impl Hash for Status

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Status

Source§

fn cmp(&self, other: &Status) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Status

Source§

fn eq(&self, other: &Status) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Status

Source§

fn partial_cmp(&self, other: &Status) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for Status

Source§

impl Eq for Status

Source§

impl StructuralPartialEq for Status

Auto Trait Implementations§

§

impl Freeze for Status

§

impl RefUnwindSafe for Status

§

impl Send for Status

§

impl Sync for Status

§

impl Unpin for Status

§

impl UnwindSafe for Status

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.