Skip to content

Instantly share code, notes, and snippets.

@demurgos
demurgos / self-ref.md
Last active February 29, 2024 12:54
self-ref rust

Rust self-references

The goal of this article is to explain the Rust Pin higher order type by exploring how Rust handles self-referential structs. Rust works best when data is modelled without cycles and there is no way to express self-referential structs directly, so creating and manipulating these kinds of struct can be a bit tricky.

What is a self-referential structs?

Supported URLs :
/me
/user/id
/historyShip/id
/historyHero/id
/group/id
/curShip
/curHero

Keybase proof

I hereby claim:

  • I am demurgos on github.
  • I am demurgos (https://keybase.io/demurgos) on keybase.
  • I have a public key ASCbE4ATLqXn-zKVANUHjJoqzUbDVJbyWxdCMeC26V-LlAo

To claim this, I am signing this object:

[package]
name = "pgrepro"
version = "0.1.0"
authors = ["Charles Samborski <demurgos@demurgos.net>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
futures-util = "0.3.13"
use std::sync::Arc;
use crate::core::{Get, UuidGenerator};
use crate::clock::Clock;
use crate::user::SimpleUserService;
#[derive(Clone)]
pub struct Api(());
pub trait ApiLike: Clone + Sized {}
use std::sync::Arc;
use crate::core::{Provider, UuidGenerator};
use crate::clock::Clock;
use crate::user::SimpleUserService;
#[derive(Clone)]
pub struct Api(());
pub trait ApiLike: Clone + Sized {}
// ==UserScript==
// @name HammerfestHeader
// @namespace hammerfest.fr
// @description Choix de la banniere Hammerfest
// @version 2
// @include http://www.hammerfest.fr/*
// @match http://www.hammerfest.fr/*
// ==/UserScript==
//Cacher les sites amis pendant une partie
interface LinearRgb {
r: number;
g: number;
b: number;
}
interface Srgb {
r: number;
g: number;
--A---------------------------
[a---------------)
+
--B---------------------------
[b-----)
+
--C---------------------------
[c--------------)

Merge

This document describes the merge algorithm.

The merge algorithm takes a list of process coverages (or smaller items) and outputs a single object combining the information in the inputs. The goal is to simulate the result V8 would have returned if the coverages were executed sequentially inside the same process instead of their own processes (so the counts are summed).