docs: document all public apis of embedded-hal-internal

* Make some fields and functions non-public where possible.
* Enable doc warnings for missing public API docs.
This commit is contained in:
Ulf Lilleengen
2023-12-08 20:42:52 +01:00
parent c94a9b8d75
commit 02b7a833d9
6 changed files with 27 additions and 2 deletions

View File

@ -1,16 +1,20 @@
//! Types for controlling when drop is invoked.
use core::mem;
use core::mem::MaybeUninit;
#[must_use = "to delay the drop handler invokation to the end of the scope"]
/// A type to delay the drop handler invocation.
#[must_use = "to delay the drop handler invocation to the end of the scope"]
pub struct OnDrop<F: FnOnce()> {
f: MaybeUninit<F>,
}
impl<F: FnOnce()> OnDrop<F> {
/// Create a new instance.
pub fn new(f: F) -> Self {
Self { f: MaybeUninit::new(f) }
}
/// Prevent drop handler from running.
pub fn defuse(self) {
mem::forget(self)
}
@ -34,6 +38,7 @@ pub struct DropBomb {
}
impl DropBomb {
/// Create a new instance.
pub fn new() -> Self {
Self { _private: () }
}