Skip to content

Instantly share code, notes, and snippets.

@jsgf
jsgf / orphanrule.als
Created August 2, 2023 15:49
Alloy model of Rust orphan rule
-- Simplified Rust crate model
--
-- Crates form a dependency DAG, starting from single top-level target (Binary)
-- Traits implemented for Types
-- Simple impls (no blanket/parameterized impls)
-- Orphan rule
-- assertion that implementations are globally coherent
-- Trait is define in exactly one crate
sig Trait {
@jsgf
jsgf / libt.json
Created July 19, 2018 20:08
Prettified save-analysis output
{
"config": {
"borrow_data": false,
"distro_crate": false,
"full_docs": false,
"output_file": null,
"pub_only": false,
"reachable_only": false,
"signatures": false
},
ISL29035: Light Intensity: 31
SI7021: Temperature: 25 deg C
SI7021: Humidity: 43%
FXOS8700CQ: X: -16
FXOS8700CQ: Y: -356
FXOS8700CQ: Z: 943
ISL29035: Light Intensity: 0
SI7021: Temperature: 25 deg C
SI7021: Humidity: 43%
use futures::{Async, AsyncSink, Future, Poll};
use futures::stream::{Fuse, Stream};
use futures::sink::Sink;
/// Fork a Stream into two
///
/// Returns a Future for a process that consumes items from a Stream and
/// forwards them to two sinks depending on a predicate. If the predicate
/// returns false, send the value to out1, otherwise out2.
pub fn streamfork<In, Out1, Out2, F, E>(inp: In, out1: Out1, out2: Out2, pred: F)
/* automatically generated by rust-bindgen */
#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
#[inline]
pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
#[inline]
/* automatically generated by rust-bindgen */
#[repr(C)]
pub struct _bindgen_mod_id_1_basic_ostream__bindgen_vtable {
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _bindgen_mod_id_1_basic_ostream<_CharT, _Traits> {
pub vtable_: *const _bindgen_mod_id_1_basic_ostream__bindgen_vtable,
pub _phantom_0: ::std::marker::PhantomData<_CharT>,

Keybase proof

I hereby claim:

  • I am jsgf on github.
  • I am jsgf (https://keybase.io/jsgf) on keybase.
  • I have a public key ASB41obcmZUrJC9lwr3RsY6MGs_qIyuGPhZivVa8nvC_uwo

To claim this, I am signing this object: