Skip to content

Instantly share code, notes, and snippets.

View Lucretiel's full-sized avatar

Nathan West Lucretiel

View GitHub Profile
@Lucretiel
Lucretiel / playground.rs
Last active October 7, 2020 06:11 — forked from rust-play/playground.rs
Code shared from the Rust Playground
trait Truthy: Sized {
fn is_truthy(&self) -> bool;
fn as_option(self) -> Option<Self> {
if self.is_truthy() {
Some(self)
} else {
None
}
}
fn or(self, default: Self) -> Self {
@Lucretiel
Lucretiel / playground.rs
Created June 22, 2019 01:48 — forked from rust-play/playground.rs
Code shared from the Rust Playground
trait Truthy: Sized {
fn is_truthy(&self) -> bool;
fn as_option(self) -> Option<Self> {
if self.is_truthy() {
Some(self)
} else {
None
}
}
}