Skip to content

Instantly share code, notes, and snippets.

View Kimundi's full-sized avatar

Marvin Löbel Kimundi

  • Dortmund, Germany
View GitHub Profile
@Kimundi
Kimundi / java_rust_generic.md
Last active March 20, 2024 06:02
A light comparison between Rust and Java generics and type system features.

Introduction

If you are familiar with Java's generics, and are coming to Rust, you might be lead to assume that its generics are working the same way.

However, due to the different type systems, and different implementation details, there are quite a few differences between generic code in both languages.

This document tries to give a short summary about those differences:

Core functionality

Java

The Borrow Checker

This pass has the job of enforcing memory safety. This is a subtle topic. This docs aim to explain both the practice and the theory behind the borrow checker. They start with a high-level overview of how it works, and then proceed to dive into the theoretical background. Finally, they go into detail on some of the more subtle aspects.

Table of contents

@Kimundi
Kimundi / dynamic_typing.rs
Last active January 6, 2023 18:56
Dynamic typing in Rust
use std::unstable::intrinsics::{TyDesc, get_tydesc, forget};
use std::util::Void;
use std::cast::transmute;
///////////////////////////////////////////////////////////////////////////////
// TypeId
///////////////////////////////////////////////////////////////////////////////
/// `TypeId` represents a globally unique identifier for a type
pub struct TypeId {
# Copyright Louis Dionne 2013-2017
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
language: c++
sudo: false
# Do not build branches of the form "pr/*". By prefixing pull requests coming
# from branches inside the repository with pr/, this avoids building both the
# branch push _and_ the pull request.
#!/usr/bin/env python3
import threading
import multiprocessing
def fork_join(jobs, results, runner, cores=None):
class SimpleCtrl:
def __init__(self):
self.aborted=False
おめでとう(ございます) : Herzlichen Glückwunsch!
え(っ) : Wie bitte?
〜という : (Rw.) ~ genannt
〜人 : (~nin) Zählwort für Menschen
あいます : treffen (sich mit jemanden)
あかひげ : Rotbart (Film)
あさって : übermorgen
あした : morgen
あたらしい : (い-adj) neu
あの : jener bzw. betreffender (+Substantiv)
〜人 : (~nin) Zählwort für Menschen
あいます : treffen (sich mit jemanden)
あかひげ : Rotbart (Film)
あさって : übermorgen
あした : morgen
あまり : nicht alzu/so/besonders (oft, viel)
(どうも)ありがとう(ございます) : Vielen Dank!
いい : (adj.) gut, schön
いいえ : Nein
いかが : wie (höflich)
です : sein
さん : Herr/Frau
はい : Ja
いいえ : Nein
か : Fragepartikel
は : Themapartikel
せんせい : Lehrer
はは : Mutter
ドイツ : Deutschland
日本 : Japan
です : sein
さん : Herr/Frau
はい : Ja
いいえ : Nein
か : Fragepartikel
は : Themapartikel
せんせい : Lehrer
はは : Mutter
ドイツ : Deutschland
日本 : Japan