Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ where
/// let x: Result<u32, &str> = Err("emergency failure");
/// x.todo(); // panics with `not yet implemented: emergency failure`
/// ```
#[track_caller]
#[cfg(not(all(feature = "disallow-todo-on-release", not(debug_assertions))))]
fn todo(self) -> T;

/// Returns the contained [`Ok`] value, consuming the `self` value.
Expand Down Expand Up @@ -141,6 +143,8 @@ pub trait OptionExt<T> {
/// let x: Option<u32> = None;
/// x.todo(); // panics with `not yet implemented: None`
/// ```
#[track_caller]
#[cfg(not(all(feature = "disallow-todo-on-release", not(debug_assertions))))]
fn todo(self) -> T;

/// Returns the contained [`Some`] value, consuming the `self` value.
Expand All @@ -162,6 +166,7 @@ pub trait OptionExt<T> {
/// let x: Option<u32> = None;
/// x.assured("always set"); // panics with `the value was assured to exist but was None: always set`
/// ```
#[track_caller]
fn assured(self, reason: &str) -> T;

/// Returns the contained [`Some`] value, consuming the `self` value.
Expand All @@ -184,6 +189,7 @@ pub trait OptionExt<T> {
/// let x: Option<u32> = None;
/// x.verified("should always be Some"); // panics with `it was verified that value presents but None was returned: should always be Some`
/// ```
#[track_caller]
fn verified(self, reason: &str) -> T;
}

Expand Down