#![warn(missing_docs)]
#![warn(rustdoc::broken_intra_doc_links)]
use std::fmt::Debug;
pub trait WipResultExt<T, E> {
#[deprecated = "explicitly handle the error case or replace with an unwrap/expect if you can prove it cannot happen"]
fn unwrap_wip(self) -> T
where
E: Debug;
fn unwrap_err_wip(self) -> E
where
T: Debug;
}
pub trait WipOptionExt<T> {
#[deprecated = "explicitly handle the `None` case or replace with an unwrap/expect if you can prove it cannot happen"]
fn unwrap_wip(self) -> T;
}
pub trait WipCloneExt: Clone {
#[deprecated = "rewrite code to make this clone unnecessary or replace with a clone if you really need it"]
fn clone_fixme(&self) -> Self;
#[deprecated = "rewrite code to make this clone unnecessary or replace with a clone if you really need it"]
fn clone_from_fixme(&mut self, source: &Self) {
Self::clone_from(self, source);
}
}
impl<T> WipCloneExt for T
where
T: Clone,
{
fn clone_fixme(&self) -> Self {
Self::clone(self)
}
}
impl<T, E> WipResultExt<T, E> for Result<T, E> {
fn unwrap_wip(self) -> T
where
E: Debug,
{
self.expect("unfinished development")
}
fn unwrap_err_wip(self) -> E
where
T: Debug,
{
self.expect_err("unfinished development")
}
}
impl<T> WipOptionExt<T> for Option<T> {
fn unwrap_wip(self) -> T {
self.expect("unfinished development")
}
}
#[macro_export]
macro_rules! wip {
() => {{
#[deprecated = "implement missing functionality or this will panic at runtime"]
fn wip() -> ! {
std::todo!()
}
wip()
}};
($($arg:tt)+) => {{
#[deprecated = "implement missing functionality or this will panic at runtime"]
fn wip() -> ! {
std::todo!($($arg)+)
}
wip()
}};
}
#[macro_export]
macro_rules! fixme {
($reason:literal) => {{
#[deprecated = $reason]
fn fixme() {}
fixme();
}};
}
#[macro_export]
macro_rules! wip_iter {
() => {{
#[deprecated = "implement missing functionality or this will panic at runtime"]
fn wip<T>() -> std::iter::Empty<T> {
std::todo!()
}
wip()
}};
($($arg:tt)+) => {{
#[deprecated = "implement missing functionality or this will panic at runtime"]
fn wip<T>() -> std::iter::Empty<T> {
std::todo!($($arg)+)
}
wip()
}};
}
#[macro_export]
macro_rules! wip_future {
() => {{
#[deprecated = "implement missing functionality or this will panic at runtime"]
fn wip<T>() -> std::future::Ready<T> {
std::todo!()
}
wip()
}};
($($arg:tt)+) => {{
#[deprecated = "implement missing functionality or this will panic at runtime"]
fn wip<T>() -> std::future::Ready<T> {
std::todo!($($arg)+)
}
wip()
}};
}
pub mod prelude {
pub use crate::{
WipCloneExt as _, WipOptionExt as _, WipResultExt as _, fixme, wip, wip_future, wip_iter,
};
}