This is all from https://github.com/thomcc/atomic_float/pull/2/checks?check_run_id=1218058098 as of 10/6/2020.
Used nightly rust.
use std::string::String; | |
use std::str::Chars; | |
use std::iter::{Enumerate, Peekable}; | |
// an xml parser that's decent enough if you don't care about parsing perf | |
// and you completely control the input. | |
#[derive(Clone, Debug)] | |
pub struct XmlNode { | |
pub tag: String, | |
pub attributes: Vec<(String, String)>, |
This is all from https://github.com/thomcc/atomic_float/pull/2/checks?check_run_id=1218058098 as of 10/6/2020.
Used nightly rust.
// https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=26888dbe066530c56f7181d3abc030e0 | |
use std::borrow::Cow; | |
pub trait IntoUtf8Lossy { | |
type String; | |
fn into_utf8_lossy(self) -> Self::String; | |
} | |
impl<'a> IntoUtf8Lossy for &'a [u8] { | |
type String = Cow<'a, str>; |
pub use std::{mem::*, ptr::NonNull, char}; | |
pub use std::marker::PhantomData; | |
pub trait EvcxrNumFmtHelp { | |
fn hex(self) -> HexF; | |
fn bin(self) -> BinF; | |
} | |
impl<I: Into<i128>> EvcxrNumFmtHelp for I { | |
fn hex(self) -> HexF { HexF(self.into() as u128, core::mem::size_of::<I>()) } | |
fn bin(self) -> BinF { BinF(self.into() as u128, core::mem::size_of::<I>()) } | |
} |
use rusqlite::types::{FromSql, FromSqlError, FromSqlResult, ValueRef}; | |
#[derive(Debug, Clone, PartialEq)] | |
pub struct LossyString(pub String); | |
impl FromSql for LossyString { | |
fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self> { | |
if let ValueRef::Text(bytes) = value { | |
let fixed = String::from_utf8_lossy(bytes).to_string(); |
extern crate proc_macro; | |
use proc_macro::{Delimiter, Group, TokenStream, TokenTree}; | |
/// usage: | |
/// ``` | |
/// #[wrap_with(my_macro!)] | |
/// pub struct Blah { ... } | |
/// ``` | |
/// | |
/// becomes |
Caveat: These are fairly rough notes.
Some team in the future pulls in the remerge android component/xpcom component/jsm/etc, authors a schema and initializes a remerge database.
They insert/update records in the database, and these changes are all checked for validity versus the schema.
The schema provides:
// note: in my actual init.evcxr, this is all on one line, but I've rustfmted it for convenience | |
// the basic idea is that i just can call `some_expr_returning_integer.hex()` or | |
// `some_expr_returning_integer.bin()` to get a pretty-printed hex or binary version. zeroes are | |
// filled in, and every 4 or 8 (for hex/binary respectively) digits has a `_` separator. | |
// It works on anything that is Into<i128>. for things that aren't into<i128> but that | |
// i find myself needing to format, (specifically u128, f32, and f64), you need | |
// to do .hexx() or .binx(). this could be fixed but this file is a pain to maintain (it's one line) | |
// so... yeah. | |
// ``` | |
// >> 30.hex() |
pub fn strip_json_comments(s: &str) -> String { | |
let mut result = String::with_capacity(s.len()); | |
let mut iter = s.chars(); | |
while let Some(c) = iter.next() { | |
if c == '"' { | |
// It's a string, skip to end without touching any comments inside. | |
result.push(c); | |
while let Some(c) = iter.next() { |
#![no_std] | |
extern crate alloc; | |
use alloc::vec::Vec; | |
use fexel_num::{vec3x, X19, x19}; | |
const ZERO: x19 = x19::from_bits(0); | |
const ONE: x19 = X19!(1.0); | |
/// The object that's used for computing the convex hull. This is basically a | |
/// bunch of scratch memory so that if you want to avoid allocating a bunch of |