跳到主要内容

Error

枚举 Error 

Source
#[non_exhaustive]
pub enum Error {
Show 22 variants InappropriateMessage { expect_types: Vec<ContentType>, got_type: ContentType, }, InappropriateHandshakeMessage { expect_types: Vec<HandshakeType>, got_type: HandshakeType, }, InvalidEncryptedClientHello(EncryptedClientHelloError), InvalidMessage(InvalidMessage), NoCertificatesPresented, UnsupportedNameType, DecryptError, EncryptError, PeerIncompatible(PeerIncompatible), PeerMisbehaved(PeerMisbehaved), AlertReceived(AlertDescription), InvalidCertificate(CertificateError), InvalidCertRevocationList(CertRevocationListError), General(String), FailedToGetCurrentTime, FailedToGetRandomBytes, HandshakeNotComplete, PeerSentOversizedRecord, NoApplicationProtocol, BadMaxFragmentSize, InconsistentKeys(InconsistentKeys), Other(OtherError),
}
展开描述

rustls 使用此类型报告协议错误。

变体 (Non-exhaustive)§

This enum is marked as non-exhaustive
非穷尽枚举未来可能添加新的变体。因此,在对非穷尽枚举的变体进行模式匹配时,必须额外增加一个通配符分支以涵盖未来的新变体。
§

InappropriateMessage

We received 一个 TLS message that isn’t valid right now. expect_types lists the message types we can expect right now. got_type 是 type we found. This error is typically caused by 一个 buggy TLS stack (the peer 或 this one), 一个 broken network, 或 an attack.

字段

§expect_types: Vec<ContentType>

我们期望的类型

§got_type: ContentType

我们收到的类型

§

InappropriateHandshakeMessage

We received 一个 TLS handshake message that isn’t valid right now. expect_types lists the handshake message types we can expect right now. got_type 是 type we found.

字段

§expect_types: Vec<HandshakeType>

我们期望的握手类型

§got_type: HandshakeType

我们收到的握手类型

§

InvalidEncryptedClientHello(EncryptedClientHelloError)

An error occurred while handling Encrypted Client Hello (ECH)。

§

InvalidMessage(InvalidMessage)

此 peer sent us 一个 TLS message with invalid contents.

§

NoCertificatesPresented

此 peer didn’t give us any 证书

§

UnsupportedNameType

此 certificate verifier doesn’t support the given type of name.

§

DecryptError

We couldn’t decrypt 一个 message. This is invariably fatal.

§

EncryptError

We couldn’t encrypt 一个 message because it was larger than the allowed message size. This should never happen if the application is using valid record sizes.

§

PeerIncompatible(PeerIncompatible)

此 peer doesn’t support 一个 protocol version/feature we require. 此 parameter gives 一个 hint as 到 what version/feature it is.

§

PeerMisbehaved(PeerMisbehaved)

此 peer deviated 从 标准 TLS protocol. 此 parameter gives 一个 hint where.

§

AlertReceived(AlertDescription)

We received 一个 fatal 警报,则为 true。 This means the peer is unhappy.

§

InvalidCertificate(CertificateError)

We saw an invalid certificate.

此 contained error is 从 证书 validation trait implementation.

§

InvalidCertRevocationList(CertRevocationListError)

提供的证书回消名单(CRL)无效。

§

General(String)

A catch-all error 用于 unlikely errors.

§

FailedToGetCurrentTime

We failed 到 figure out what time it currently is.

§

FailedToGetRandomBytes

We failed 到 acquire random bytes 从 the system.

§

HandshakeNotComplete

在 TLS 握手完成之前,此函数无法作用。

§

PeerSentOversizedRecord

此 peer sent an oversized record/fragment.

§

NoApplicationProtocol

进来的连接不支持任何已知的应用协议。

§

BadMaxFragmentSize

max_fragment_size value supplied in configuration was too small, 或 too large.

§

InconsistentKeys(InconsistentKeys)

Specific failure cases 从 keys_match 或 一个 crate::crypto::signer::SigningKey that cannot produce 一个 corresponding 公钥.

§

Other(OtherError)

Any other error.

This variant should only be 用 when the error is not better described by 一个 more specific variant. For example, if 一个 custom crypto provider returns 一个 provider specific error.

Enums holding this variant will never compare equal 到 each other.

Trait 实现§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Error

返回值的副本。 更多信息
1.0.0 · Source§

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

Performs copy-assignment 从 source. 更多信息
Source§

impl Debug for Error

Source§

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

使用给定的格式化器格式化此值。 更多信息
Source§

impl Display for Error

Source§

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

使用给定的格式化器格式化此值。 更多信息
Source§

impl Error for Error

Available on crate feature std only.
1.30.0 · Source§

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

返回此错误的更底层来源(若有)。 更多信息
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 到 context intended 用于 error reports. 更多信息
Source§

impl From<CertRevocationListError> for Error

Source§

fn from(e: CertRevocationListError) -> Self

从输入类型转换为此类型。
Source§

impl From<CertificateError> for Error

Source§

fn from(e: CertificateError) -> Self

从输入类型转换为此类型。
Source§

impl From<EncryptedClientHelloError> for Error

Source§

fn from(e: EncryptedClientHelloError) -> Self

从输入类型转换为此类型。
Source§

impl From<GetRandomFailed> for Error

Source§

fn from(_: GetRandomFailed) -> Self

从输入类型转换为此类型。
Source§

impl From<InconsistentKeys> for Error

Source§

fn from(e: InconsistentKeys) -> Self

从输入类型转换为此类型。
Source§

impl From<InvalidMessage> for Error

Source§

fn from(e: InvalidMessage) -> Self

从输入类型转换为此类型。
Source§

impl From<OtherError> for Error

Source§

fn from(value: OtherError) -> Self

从输入类型转换为此类型。
Source§

impl From<PeerIncompatible> for Error

Source§

fn from(e: PeerIncompatible) -> Self

从输入类型转换为此类型。
Source§

impl From<PeerMisbehaved> for Error

Source§

fn from(e: PeerMisbehaved) -> Self

从输入类型转换为此类型。
Source§

impl From<SystemTimeError> for Error

Available on crate feature std only.
Source§

fn from(_: SystemTimeError) -> Self

从输入类型转换为此类型。
Source§

impl From<UnsupportedOperationError> for Error

Source§

fn from(value: UnsupportedOperationError) -> Self

从输入类型转换为此类型。
Source§

impl PartialEq for Error

Source§

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

测试 selfother 值是否相等,供 == 运算符使用。
1.0.0 · Source§

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

测试 != 运算符。默认实现几乎总是够用,除非有非常充分的理由,否则不应被覆盖。
Source§

impl StructuralPartialEq for Error

自动 Trait 实现§

§

impl Freeze for Error

§

impl !RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl !UnwindSafe for Error

Blanket 实现§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. 更多信息
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows 从 an owned value. 更多信息
Source§

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

Source§

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

Mutably borrows 从 an owned value. 更多信息
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 从 selfdest. 更多信息
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

原样返回传入的参数。

Source§

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

Source§

fn into(self) -> U

Calls U::从(self)

That is, this conversion is whatever the implementation of From<T> 用于 U 的实现方式。

Source§

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

Source§

type Owned = T

获得所有权后的类型。
Source§

fn to_owned(&self) -> T

Creates owned data 从 borrowed data, usually by cloning. 更多信息
Source§

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

Uses borrowed data 到 replace owned data, usually by cloning. 更多信息
Source§

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

Source§

fn to_string(&self) -> String

Converts the given value 到 一个 String. 更多信息
Source§

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

Source§

type Error = Infallible

转换出错时返回的类型。
Source§

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

执行转换。
Source§

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

Source§

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

转换出错时返回的类型。
Source§

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

执行转换。