This file contains 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 { | |
serde::{de, Deserialize, Serialize}, | |
std::{error, fmt, hint, num::NonZeroU128, slice, str}, | |
}; | |
/// Small limited alloc free string. | |
/// | |
/// The name has the same layout as `&str` and also has a niche. | |
/// | |
/// # Invariants |
This file contains 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 { | |
clap::Parser, | |
image::{io::Reader, ImageOutputFormat}, | |
std::{ | |
error, | |
io::{self, Cursor, Read, Write}, | |
}, | |
}; | |
type Error = Box<dyn error::Error>; |
This file contains 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 { | |
pulldown_cmark::{ | |
escape::{self, StrWrite}, | |
Event, HeadingLevel as Hl, Parser, Tag, | |
}, | |
std::{ | |
fmt::{self, Arguments}, | |
io::{self, Error, ErrorKind}, | |
}, | |
}; |
This file contains 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::string::FromUtf8Error; | |
fn username() -> Result<String, Error> { | |
use std::{ffi::CStr, mem::MaybeUninit}; | |
const BUFLEN: usize = 256; | |
unsafe { | |
let uid = libc::getuid(); | |
let mut pwd: MaybeUninit<libc::passwd> = MaybeUninit::uninit(); |
This file contains 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
#![feature(iter_intersperse)] | |
use std::fmt; | |
struct Format<T>(pub T); | |
impl<T: fmt::Display> fmt::Display for Format<T> { | |
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | |
use std::{str, io::{Write, Cursor, ErrorKind}}; | |