Skip to content

Commit 1701ef8

Browse files
committed
Front the load_native_certs function in lib.rs
This saves some duplication in rustdoc.
1 parent 3e97326 commit 1701ef8

File tree

4 files changed

+16
-32
lines changed

4 files changed

+16
-32
lines changed

src/lib.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,19 @@ mod macos;
2323
#[cfg(target_os = "macos")]
2424
use macos as platform;
2525

26-
pub use platform::load_native_certs;
26+
use rustls::RootCertStore;
27+
use std::io::Error;
28+
29+
/// Loads root certificates found in the platform's native certificate
30+
/// store.
31+
///
32+
/// On success, this returns a `rustls::RootCertStore` loaded with a
33+
/// snapshop of the root certificates found on this platform. This
34+
/// function fails in a platform-specific way, expressed in a `std::io::Error`.
35+
///
36+
/// This function can be expensive: on some platforms it involves loading
37+
/// and parsing a ~300KB disk file. It's therefore prudent to call
38+
/// this sparingly.
39+
pub fn load_native_certs() -> PartialResult<RootCertStore, Error> {
40+
platform::load_native_certs()
41+
}

src/macos.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,6 @@ use std::collections::HashMap;
99

1010
use crate::PartialResult;
1111

12-
/// Loads root certificates found in the platform's native certificate
13-
/// store.
14-
///
15-
/// On success, this returns a `rustls::RootCertStore` loaded with a
16-
/// snapshop of the root certificates found on this platform. This
17-
/// function fails in a platform-specific way, expressed in a `std::io::Error`.
18-
///
19-
/// This function can be expensive: on some platforms it involves loading
20-
/// and parsing a ~300KB disk file. It's therefore prudent to call
21-
/// this sparingly.
2212
pub fn load_native_certs() -> PartialResult<RootCertStore, Error> {
2313
let mut store = RootCertStore::empty();
2414

src/unix.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,6 @@ fn load_file(store: &mut RootCertStore, path: &Path) -> Result<(), Error> {
1818
}
1919
}
2020

21-
/// Loads root certificates found in the platform's native certificate
22-
/// store.
23-
///
24-
/// On success, this returns a `rustls::RootCertStore` loaded with a
25-
/// snapshop of the root certificates found on this platform. This
26-
/// function fails in a platform-specific way, expressed in a `std::io::Error`.
27-
/// It may produce partial output.
28-
///
29-
/// This function can be expensive: on some platforms it involves loading
30-
/// and parsing a ~300KB disk file. It's therefore prudent to call
31-
/// this sparingly.
3221
pub fn load_native_certs() -> PartialResult<RootCertStore, Error> {
3322
let likely_locations = openssl_probe::probe();
3423
let mut store = RootCertStore::empty();

src/windows.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,6 @@ fn usable_for_rustls(uses: schannel::cert_context::ValidUses) -> bool {
1515
}
1616
}
1717

18-
/// Loads root certificates found in the platform's native certificate
19-
/// store.
20-
///
21-
/// On success, this returns a `rustls::RootCertStore` loaded with a
22-
/// snapshop of the root certificates found on this platform. This
23-
/// function fails in a platform-specific way, expressed in a `std::io::Error`.
24-
///
25-
/// This function can be expensive: on some platforms it involves loading
26-
/// and parsing a ~300KB disk file. It's therefore prudent to call
27-
/// this sparingly.
2818
pub fn load_native_certs() -> PartialResult<RootCertStore, Error> {
2919
let mut store = RootCertStore::empty();
3020
let mut first_error = None;

0 commit comments

Comments
 (0)