#tls-api #tls #stub #error #api-error #tls-connector #return

tls-api-stub-2

TLS API implementation that returns error on any operation

1 unstable release

0.11.0 May 7, 2024

#13 in #tls-connector


Used in tls-api-security-framewor…

MIT/Apache

105KB
2K SLoC

tls-api-stub-2

This is a fork of tls-api-stub with updated dependencies.

Stub implementation of tls-api. All operations return an error.

Useful when you need an implementation of type like TlsConnector, but you do not intend to use it.

E. g.

fn connect<C : tls_api::TlsConnector>(host: &str, use_tls: bool) { ... }

So if the function is to be used without TLS, it can be called with stub implementation:

connect::<tls_api_stub::TlsConnector>("database", false);

lib.rs:

Stub implementation of TLS API.

All operations return error. No objects can be instantiated.

Can be useful when you need a type parameter of type e. g. TlsConnector:

use tls_api_stub_2::TlsConnector;

let no_connector: Option<TlsConnector> = None;

Dependencies

~8–19MB
~374K SLoC