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
连接相关错误
DeviceNotFound
设备未找到错误
CommandFailed
命令执行失败
ProtocolError
协议错误
ParseError
解析错误
FileOperationFailed
文件操作错误
NetworkError
网络错误
Timeout
超时错误
PermissionDenied
权限错误
ApplicationError
应用相关错误
Io(Error)
IO错误的包装
Regex(Error)
正则表达式错误
Utf8(Utf8Error)
UTF-8编码错误
ParseInt(ParseIntError)
数字解析错误
SystemTime(SystemTimeError)
时间相关错误
Anyhow(Error)
Anyhow错误的包装 - 新增
Unknown
其他未分类错误
Implementations§
Source§impl AdbError
impl AdbError
Sourcepub fn from_display<E: Display>(err: E) -> Self
pub fn from_display<E: Display>(err: E) -> Self
从任何实现了Display的错误创建
Sourcepub fn connection_failed<S: Into<String>>(message: S) -> Self
pub fn connection_failed<S: Into<String>>(message: S) -> Self
创建连接失败错误
Sourcepub fn device_not_found<S: Into<String>>(serial: S) -> Self
pub fn device_not_found<S: Into<String>>(serial: S) -> Self
创建设备未找到错误
Sourcepub fn command_failed<S1: Into<String>, S2: Into<String>>(
command: S1,
reason: S2,
) -> Self
pub fn command_failed<S1: Into<String>, S2: Into<String>>( command: S1, reason: S2, ) -> Self
创建命令执行失败错误
Sourcepub fn protocol_error<S: Into<String>>(message: S) -> Self
pub fn protocol_error<S: Into<String>>(message: S) -> Self
创建协议错误
Sourcepub fn parse_error<S: Into<String>>(message: S) -> Self
pub fn parse_error<S: Into<String>>(message: S) -> Self
创建解析错误
Sourcepub fn file_operation_failed<S1: Into<String>, S2: Into<String>>(
operation: S1,
path: S2,
) -> Self
pub fn file_operation_failed<S1: Into<String>, S2: Into<String>>( operation: S1, path: S2, ) -> Self
创建文件操作错误
Sourcepub fn network_error<S: Into<String>>(message: S) -> Self
pub fn network_error<S: Into<String>>(message: S) -> Self
创建网络错误
Sourcepub fn permission_denied<S: Into<String>>(message: S) -> Self
pub fn permission_denied<S: Into<String>>(message: S) -> Self
创建权限错误
Sourcepub fn application_error<S1: Into<String>, S2: Into<String>>(
package_name: S1,
message: S2,
) -> Self
pub fn application_error<S1: Into<String>, S2: Into<String>>( package_name: S1, message: S2, ) -> Self
创建应用错误
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
检查是否为可重试的错误
Sourcepub fn error_code(&self) -> &'static str
pub fn error_code(&self) -> &'static str
获取错误的简短描述
Trait Implementations§
Source§impl Error for AdbError
impl Error for AdbError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<ParseIntError> for AdbError
impl From<ParseIntError> for AdbError
Source§fn from(source: ParseIntError) -> Self
fn from(source: ParseIntError) -> Self
Converts to this type from the input type.
Source§impl From<SystemTimeError> for AdbError
impl From<SystemTimeError> for AdbError
Source§fn from(source: SystemTimeError) -> Self
fn from(source: SystemTimeError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for AdbError
impl !RefUnwindSafe for AdbError
impl Send for AdbError
impl Sync for AdbError
impl Unpin for AdbError
impl !UnwindSafe for AdbError
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
Mutably borrows from an owned value. Read more