Skip to content

Instantly share code, notes, and snippets.

@tesaguri
Created September 28, 2023 12:46
Show Gist options
  • Save tesaguri/9c37e1ce2e8969957a2d5e6efeae5865 to your computer and use it in GitHub Desktop.
Save tesaguri/9c37e1ce2e8969957a2d5e6efeae5865 to your computer and use it in GitHub Desktop.
Too Many Questions
#![feature(try_trait_v2)]
use core::ops::{ControlFlow, FromResidual, Try};
#[allow(dead_code)]
fn questions(x: Undemystifiable) -> Undemystifiable {
x????????????????????????????????????????????????????????????????
}
struct Undemystifiable;
impl Try for Undemystifiable {
type Output = Self;
type Residual = Self;
fn from_output(output: Self::Output) -> Self {
output
}
fn branch(self) -> ControlFlow<Self::Residual, Self::Output> {
ControlFlow::Continue(Self)
}
}
impl FromResidual<Undemystifiable> for Undemystifiable {
fn from_residual(residual: Undemystifiable) -> Self {
residual
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment