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
impl Status
Sourcepub fn new_service_specific_error(err: i32, message: Option<&CStr>) -> Status
pub fn new_service_specific_error(err: i32, message: Option<&CStr>) -> Status
Create a status object from a service specific error
Sourcepub fn new_service_specific_error_str<T: AsRef<str>>(
err: i32,
message: Option<T>,
) -> Status
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.
Sourcepub fn new_exception(exception: ExceptionCode, message: Option<&CStr>) -> Status
pub fn new_exception(exception: ExceptionCode, message: Option<&CStr>) -> Status
Create a status object from an exception code
Sourcepub fn new_exception_str<T: AsRef<str>>(
exception: ExceptionCode,
message: Option<T>,
) -> Status
pub fn new_exception_str<T: AsRef<str>>( exception: ExceptionCode, message: Option<T>, ) -> Status
Creates a status object from an exception code and message.
Sourcepub fn get_description(&self) -> String
pub fn get_description(&self) -> String
Returns a description of the status.
Sourcepub fn exception_code(&self) -> ExceptionCode
pub fn exception_code(&self) -> ExceptionCode
Returns the exception code of the status.
Sourcepub fn transaction_error(&self) -> StatusCode
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.
Sourcepub fn service_specific_error(&self) -> i32
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.
Trait Implementations§
Source§impl Deserialize for Status
impl Deserialize for Status
Source§type UninitType = Option<Status>
type UninitType = Option<Status>
Self
if the type implements Default
, Option<Self>
otherwise.Source§fn uninit() -> Self::UninitType
fn uninit() -> Self::UninitType
Source§fn from_init(value: Self) -> Self::UninitType
fn from_init(value: Self) -> Self::UninitType
Self
into Self::UninitType
.Source§fn deserialize(parcel: &BorrowedParcel<'_>) -> Result<Self, StatusCode>
fn deserialize(parcel: &BorrowedParcel<'_>) -> Result<Self, StatusCode>
crate::parcel::Parcel
.Source§const ASSERT_UNINIT_SIZE_AND_ALIGNMENT: bool = _
const ASSERT_UNINIT_SIZE_AND_ALIGNMENT: bool = _
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>
fn deserialize_from( &mut self, parcel: &BorrowedParcel<'_>, ) -> Result<(), StatusCode>
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 Error for Status
impl Error for Status
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<android_c_interface_ExceptionCode> for Status
impl From<android_c_interface_ExceptionCode> for Status
Source§fn from(code: ExceptionCode) -> Status
fn from(code: ExceptionCode) -> Status
Source§impl From<android_c_interface_StatusCode> for Status
impl From<android_c_interface_StatusCode> for Status
Source§fn from(status: StatusCode) -> Status
fn from(status: StatusCode) -> Status
Source§impl Serialize for Status
impl Serialize for Status
Source§fn serialize(&self, parcel: &mut BorrowedParcel<'_>) -> Result<(), StatusCode>
fn serialize(&self, parcel: &mut BorrowedParcel<'_>) -> Result<(), StatusCode>
crate::parcel::Parcel
.impl Eq for Status
impl Send for Status
impl Sync for Status
Auto Trait Implementations§
impl Freeze for Status
impl RefUnwindSafe for Status
impl Unpin for Status
impl UnwindSafe for Status
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.