http-type 18.4.1

A comprehensive Rust type library for HTTP operations and concurrent programming. Provides core HTTP types (Request/Response with builder patterns, Method, HttpStatus, HttpVersion, ContentType, FileExtension with MIME mapping, Cookie parsing/building, HttpUrl parsing, WebSocket frame/opcode, protocol upgrade types, stream/task management, panic handling), thread-safe concurrent wrappers (ArcMutex, ArcRwLock, BoxRwLock, RcRwLock), dynamic dispatch types (BoxAny, RcAny, ArcAny with Send/Sync variants), high-performance hash collections (HashMapXxHash3_64, HashSetXxHash3_64), and static lifetime utilities (BoxLeak, Lifetime trait).
Documentation
use crate::*;

struct TestLifetimeStruct {
    value: i32,
}

impl Lifetime for TestLifetimeStruct {
    unsafe fn leak(&self) -> &'static Self {
        let boxed: Box<Self> = Box::new(Self { value: self.value });
        Box::leak(boxed)
    }
    unsafe fn leak_mut(&self) -> &'static mut Self {
        let mut boxed: Box<Self> = Box::new(Self { value: self.value });
        let reference: *mut Self = std::ptr::addr_of_mut!(*boxed);
        std::mem::forget(boxed);
        unsafe { &mut *reference }
    }
}

#[test]
fn test_lifetime_trait_leak() {
    let data: TestLifetimeStruct = TestLifetimeStruct { value: 42 };
    let leaked: &'static TestLifetimeStruct = unsafe { data.leak() };
    assert_eq!(leaked.value, 42);
}

#[test]
fn test_lifetime_trait_leak_mut() {
    let data: TestLifetimeStruct = TestLifetimeStruct { value: 10 };
    let leaked: &'static mut TestLifetimeStruct = unsafe { data.leak_mut() };
    assert_eq!(leaked.value, 10);
    leaked.value = 99;
    assert_eq!(leaked.value, 99);
}

#[test]
fn test_lifetime_trait_leak_preserves_value() {
    let data: TestLifetimeStruct = TestLifetimeStruct { value: 100 };
    let leaked: &'static TestLifetimeStruct = unsafe { data.leak() };
    assert_eq!(leaked.value, 100);
}