Skip to content

Commit 37a1ab8

Browse files
committed
Move implementation docs
1 parent d6f5ea7 commit 37a1ab8

1 file changed

Lines changed: 21 additions & 22 deletions

File tree

src/lib.rs

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -35,30 +35,29 @@ pub use sys_rng::SysRng;
3535

3636
pub use crate::error::{Error, RawOsError};
3737

38+
/// Provides Externally Implementable Interfaces for the core functionality of this crate.
39+
/// This allows `getrandom` to provide a default implementation and a common interface
40+
/// for all crates to use, while giving users a safe way to override that default where required.
41+
///
42+
/// Must be enabled via the `extern_item_impls` opt-in backend, as this functionality
43+
/// is currently limited to nightly.
44+
///
45+
/// # Examples
46+
///
47+
/// ```rust
48+
/// # use core::mem::MaybeUninit;
49+
/// # #[cfg(getrandom_backend = "extern_item_impls")]
50+
/// #[getrandom::implementation::fill_uninit]
51+
/// fn my_fill_uninit_implementation(
52+
/// dest: &mut [MaybeUninit<u8>]
53+
/// ) -> Result<(), getrandom::Error> {
54+
/// // ...
55+
/// # let _ = dest;
56+
/// # Err(Error::UNSUPPORTED)
57+
/// }
58+
/// ```
3859
#[cfg(getrandom_backend = "extern_item_impls")]
3960
pub mod implementation {
40-
//! Provides Externally Implementable Interfaces for the core functionality of this crate.
41-
//! This allows `getrandom` to provide a default implementation and a common interface
42-
//! for all crates to use, while giving users a safe way to override that default where required.
43-
//!
44-
//! Must be enabled via the `extern_item_impls` opt-in backend, as this functionality
45-
//! is currently limited to nightly.
46-
//!
47-
//! # Examples
48-
//!
49-
//! ```rust
50-
//! # use core::mem::MaybeUninit;
51-
//! # #[cfg(getrandom_backend = "extern_item_impls")]
52-
//! #[getrandom::implementation::fill_uninit]
53-
//! fn my_fill_uninit_implementation(
54-
//! dest: &mut [MaybeUninit<u8>]
55-
//! ) -> Result<(), getrandom::Error> {
56-
//! // ...
57-
//! # let _ = dest;
58-
//! # Err(Error::UNSUPPORTED)
59-
//! }
60-
//! ```
61-
6261
pub use crate::backends::extern_item_impls::{fill_uninit, u32, u64};
6362
}
6463

0 commit comments

Comments
 (0)