Skip to content

Commit d74eaee

Browse files
committed
x509-cert: gate documentation sample on pem feature
1 parent 01c2430 commit d74eaee

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

x509-cert/src/certificate.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ impl<P: Profile> TbsCertificateInner<P> {
171171
/// boolean.
172172
///
173173
/// ```
174+
/// # #[cfg(feature = "pem")]
175+
/// # fn pemonly() {
174176
/// # const CERT_PEM: &str = include_str!("../tests/examples/amazon.pem");
175177
/// use x509_cert::{der::DecodePem, ext::pkix::BasicConstraints, Certificate};
176178
/// let certificate = Certificate::from_pem(CERT_PEM.as_bytes()).expect("parse certificate");
@@ -179,6 +181,7 @@ impl<P: Profile> TbsCertificateInner<P> {
179181
/// .expect("Failed to parse extension")
180182
/// .expect("Basic constraints expected");
181183
/// # let _ = constraints;
184+
/// # }
182185
/// ```
183186
///
184187
/// # Errors
@@ -204,6 +207,8 @@ impl<P: Profile> TbsCertificateInner<P> {
204207
/// Returns a filtered iterator over all the extensions with the OID.
205208
///
206209
/// ```
210+
/// # #[cfg(feature = "pem")]
211+
/// # fn pemonly() {
207212
/// # const CERT_PEM: &str = include_str!("../tests/examples/amazon.pem");
208213
/// use x509_cert::{der::DecodePem, ext::pkix::BasicConstraints, Certificate};
209214
/// let certificate = Certificate::from_pem(CERT_PEM.as_bytes()).expect("parse certificate");
@@ -212,6 +217,7 @@ impl<P: Profile> TbsCertificateInner<P> {
212217
/// while let Some(Ok((critical, extension))) = extensions_found.next() {
213218
/// println!("Found (critical={critical}): {extension:?}");
214219
/// }
220+
/// # }
215221
/// ```
216222
///
217223
/// # Safety

0 commit comments

Comments
 (0)