AdbError

Enum AdbError 

Source
pub enum AdbError {
Show 17 variants ConnectionFailed { message: String, }, DeviceNotFound { serial: String, }, CommandFailed { command: String, reason: String, }, ProtocolError { message: String, }, ParseError { message: String, }, FileOperationFailed { operation: String, path: String, }, NetworkError { message: String, }, Timeout { seconds: u64, }, PermissionDenied { message: String, }, ApplicationError { package_name: String, message: String, }, Io(Error), Regex(Error), Utf8(Utf8Error), ParseInt(ParseIntError), SystemTime(SystemTimeError), Anyhow(Error), Unknown { message: String, },
}
Expand description

ADB操作中可能出现的错误类型

Variants§

§

ConnectionFailed

连接相关错误

Fields

§message: String
§

DeviceNotFound

设备未找到错误

Fields

§serial: String
§

CommandFailed

命令执行失败

Fields

§command: String
§reason: String
§

ProtocolError

协议错误

Fields

§message: String
§

ParseError

解析错误

Fields

§message: String
§

FileOperationFailed

文件操作错误

Fields

§operation: String
§path: String
§

NetworkError

网络错误

Fields

§message: String
§

Timeout

超时错误

Fields

§seconds: u64
§

PermissionDenied

权限错误

Fields

§message: String
§

ApplicationError

应用相关错误

Fields

§package_name: String
§message: String
§

Io(Error)

IO错误的包装

§

Regex(Error)

正则表达式错误

§

Utf8(Utf8Error)

UTF-8编码错误

§

ParseInt(ParseIntError)

数字解析错误

§

SystemTime(SystemTimeError)

时间相关错误

§

Anyhow(Error)

Anyhow错误的包装 - 新增

§

Unknown

其他未分类错误

Fields

§message: String

Implementations§

Source§

impl AdbError

Source

pub fn from_display<E: Display>(err: E) -> Self

从任何实现了Display的错误创建

Source

pub fn connection_failed<S: Into<String>>(message: S) -> Self

创建连接失败错误

Source

pub fn device_not_found<S: Into<String>>(serial: S) -> Self

创建设备未找到错误

Source

pub fn command_failed<S1: Into<String>, S2: Into<String>>( command: S1, reason: S2, ) -> Self

创建命令执行失败错误

Source

pub fn protocol_error<S: Into<String>>(message: S) -> Self

创建协议错误

Source

pub fn parse_error<S: Into<String>>(message: S) -> Self

创建解析错误

Source

pub fn file_operation_failed<S1: Into<String>, S2: Into<String>>( operation: S1, path: S2, ) -> Self

创建文件操作错误

Source

pub fn network_error<S: Into<String>>(message: S) -> Self

创建网络错误

Source

pub fn timeout(seconds: u64) -> Self

创建超时错误

Source

pub fn permission_denied<S: Into<String>>(message: S) -> Self

创建权限错误

Source

pub fn application_error<S1: Into<String>, S2: Into<String>>( package_name: S1, message: S2, ) -> Self

创建应用错误

Source

pub fn unknown<S: Into<String>>(message: S) -> Self

创建未知错误

Source

pub fn is_retryable(&self) -> bool

检查是否为可重试的错误

Source

pub fn is_fatal(&self) -> bool

检查是否为致命错误(不应重试)

Source

pub fn error_code(&self) -> &'static str

获取错误的简短描述

Trait Implementations§

Source§

impl Debug for AdbError

Source§

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

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

impl Display for AdbError

Source§

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

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

impl Error for AdbError

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 AdbError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for AdbError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for AdbError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<ParseIntError> for AdbError

Source§

fn from(source: ParseIntError) -> Self

Converts to this type from the input type.
Source§

impl From<SystemTimeError> for AdbError

Source§

fn from(source: SystemTimeError) -> Self

Converts to this type from the input type.
Source§

impl From<Utf8Error> for AdbError

Source§

fn from(source: Utf8Error) -> Self

Converts to this type from the input type.

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more