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.
| static A: AtomicU8 = AtomicU8::new(0); | |
| static B: AtomicU8 = AtomicU8::new(0); | |
| const ORDER: Ordering = ???; | |
| let writer_0 = thread::spawn(|| { | |
| A.store(1, ORDER); | |
| }); | |
| let writer_1 = thread::spawn(|| { | |
| B.store(1, ORDER); |
| // float->sRGB8 conversions - two variants. | |
| // by Fabian "ryg" Giesen | |
| // | |
| // I hereby place this code in the public domain. | |
| // | |
| // Both variants come with absolute error bounds and a reversibility and monotonicity | |
| // guarantee (see test driver code below). They should pass D3D10 conformance testing | |
| // (not that you can verify this, but still). They are verified against a clean reference | |
| // implementation provided below, and the test driver checks all floats exhaustively. | |
| // |
| #[derive(Clone, Debug)] | |
| pub struct XmlNode { | |
| pub tag: String, | |
| pub attributes: Vec<(String, String)>, | |
| pub children: Vec<XmlNode>, | |
| pub body: String, | |
| } | |
| impl XmlNode { | |
| pub fn new(tag: String) -> XmlNode { |
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() |