This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ========================================================================= | |
| // CORE TYPES & TRAIT | |
| // ========================================================================= | |
| #[derive(Debug, Clone, Copy, PartialEq, Eq)] | |
| enum Move { | |
| Cooperate, | |
| Defect, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ========================================================================= | |
| // CORE TYPES & TRAIT | |
| // ========================================================================= | |
| #[derive(Debug, Clone, Copy, PartialEq, Eq)] | |
| enum Move { | |
| Cooperate, | |
| Defect, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::fmt; | |
| /// The two possible moves a player can make in the Prisoner's Dilemma. | |
| #[derive(Debug, Clone, Copy, PartialEq, Eq)] | |
| enum Move { | |
| Cooperate, | |
| Defect, | |
| } | |
| /// Represents a game-theoretic strategy. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::fmt; | |
| /// The two possible moves a player can make in the Prisoner's Dilemma. | |
| #[derive(Debug, Clone, Copy, PartialEq, Eq)] | |
| enum Move { | |
| Cooperate, | |
| Defect, | |
| } | |
| /// Represents a game-theoretic strategy. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // mayan_cal.rs | |
| use std::fmt; | |
| /// Mayan Long Count | |
| #[derive(Debug, Clone, Copy, PartialEq, Eq)] | |
| pub struct LongCount { | |
| pub baktun: u32, | |
| pub katun: u32, | |
| pub tun: u32, | |
| pub uinal: u32, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use crossbeam_utils::CachePadded; | |
| use std::cell::UnsafeCell; | |
| use std::mem::MaybeUninit; | |
| use std::sync::atomic::{AtomicUsize, Ordering}; | |
| use std::sync::Arc; | |
| use std::thread; | |
| pub struct RingBuffer<T, const N: usize> { | |
| pub head: CachePadded<AtomicUsize>, | |
| pub tail: CachePadded<AtomicUsize>, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //! Collatz sequence analyzer demonstrating both wrapping and saturating arithmetic. | |
| //! Context: BIP-64MOD + GCC alignment verification | |
| use std::num::Wrapping; | |
| /// A demo function showing how saturating arithmetic behaves at the upper limit. | |
| /// Instead of wrapping around to 0, it caps the value safely at u64::MAX. | |
| pub fn demo_saturating_arithmetic(n: u64) -> u64 { | |
| // If n is close to u64::MAX, regular arithmetic would panic in debug. | |
| // saturating_mul and saturating_add will safely clamp the value at u64::MAX. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use chrono::{DateTime, Local, Duration}; | |
| use std::ops::Deref; | |
| struct Meeting { | |
| name: String, | |
| start_time: DateTime<Local>, | |
| } | |
| impl Deref for Meeting { | |
| type Target = DateTime<Local>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct Wrapper(String); | |
| impl std::ops::Deref for Wrapper { | |
| type Target = String; | |
| fn deref(&self) -> &String { | |
| &self.0 | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //! Generalizing Cryptographic Reductions and the Forking Lemma in Pure Rust. | |
| //! This implementation relies strictly on the standard library. | |
| use std::collections::HashMap; | |
| use std::cell::RefCell; | |
| // ========================================================================= | |
| // 1. Core Mathematical Abstractions (Prime Field & Mock Curve) | |
| // ========================================================================= |
NewerOlder