binder

Struct Status

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

High-level binder status object that encapsulates a standard way to keep track of and chain binder errors along with service specific errors.

Used in AIDL transactions to represent failed transactions.

Implementations§

Source§

impl Status

Source

pub fn ok() -> Self

Create a status object representing a successful transaction.

Source

pub fn new_service_specific_error(err: i32, message: Option<&CStr>) -> Status

Create a status object from a service specific error

Source

pub fn new_service_specific_error_str<T: AsRef<str>>( err: i32, message: Option<T>, ) -> Status

Creates a status object from a service specific error.

Source

pub fn new_exception(exception: ExceptionCode, message: Option<&CStr>) -> Status

Create a status object from an exception code

Source

pub fn new_exception_str<T: AsRef<str>>( exception: ExceptionCode, message: Option<T>, ) -> Status

Creates a status object from an exception code and message.

Source

pub fn is_ok(&self) -> bool

Returns true if this status represents a successful transaction.

Source

pub fn get_description(&self) -> String

Returns a description of the status.

Source

pub fn exception_code(&self) -> ExceptionCode

Returns the exception code of the status.

Source

pub fn transaction_error(&self) -> StatusCode

Return a status code representing a transaction failure, or StatusCode::OK if there was no transaction failure.

If this method returns OK, the status may still represent a different exception or a service specific error. To find out if this transaction as a whole is okay, use is_ok instead.

Source

pub fn service_specific_error(&self) -> i32

Return a service specific error if this status represents one.

This function will only ever return a non-zero result if exception_code returns ExceptionCode::SERVICE_SPECIFIC. If this function returns 0, the status object may still represent a different exception or status. To find out if this transaction as a whole is okay, use is_ok instead.

Source

pub fn and_then<T, F>(self, op: F) -> Result<T, Status>
where F: FnOnce() -> Result<T, Status>,

Calls op if the status was ok, otherwise returns an Err value of self.

Trait Implementations§

Source§

impl Debug for Status

Source§

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

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

impl Deserialize for Status

Source§

type UninitType = Option<Status>

Type for the uninitialized value of this type. Will be either Self if the type implements Default, Option<Self> otherwise.
Source§

fn uninit() -> Self::UninitType

Return an uninitialized or default-initialized value for this type.
Source§

fn from_init(value: Self) -> Self::UninitType

Convert an initialized value of type Self into Self::UninitType.
Source§

fn deserialize(parcel: &BorrowedParcel<'_>) -> Result<Self, StatusCode>

Deserialize an instance from the given crate::parcel::Parcel.
Source§

const ASSERT_UNINIT_SIZE_AND_ALIGNMENT: bool = _

Assert at compile-time that Self and Self::UninitType have the same size and alignment. This will either fail to compile or evaluate to true. The only two macros that work here are panic! and assert!, so we cannot use assert_eq!.
Source§

fn deserialize_from( &mut self, parcel: &BorrowedParcel<'_>, ) -> Result<(), StatusCode>

Deserialize an instance from the given crate::parcel::Parcel onto the current object. This operation will overwrite the old value partially or completely, depending on how much data is available.
Source§

impl Display for Status

Source§

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

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

impl Drop for Status

Source§

fn drop(&mut self)

Executes the destructor for this type. 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<Status> for Result<(), Status>

Source§

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

Converts to this type from the input type.
Source§

impl From<Status> for status_t

Source§

fn from(status: Status) -> status_t

Converts to this type from the input type.
Source§

impl From<android_c_interface_ExceptionCode> for Status

Source§

fn from(code: ExceptionCode) -> Status

Converts to this type from the input type.
Source§

impl From<android_c_interface_StatusCode> for Status

Source§

fn from(status: StatusCode) -> Status

Converts to this type from the input type.
Source§

impl From<i32> for Status

Source§

fn from(status: status_t) -> Status

Converts to this type from the input type.
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 Serialize for Status

Source§

fn serialize(&self, parcel: &mut BorrowedParcel<'_>) -> Result<(), StatusCode>

Serialize this instance into the given crate::parcel::Parcel.
Source§

impl Eq for Status

Source§

impl Send for Status

Source§

impl Sync for Status

Auto Trait Implementations§

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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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> ToString for T
where T: Display + ?Sized,

Source§

default 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.