Rust でオレオレ文字列型を定義して既存コードに散りばめられた String
を置き換えたい気持ちになることがあります。
単純に API を追加して事足りる場合、必要な API をトレイトで定義した上で String
に実装すれば十分です:
trait PushNewLine {
fn push_newline(&mut self);
}
# Wireless | |
pacman -S wpa_supplicant | |
pacman -S dialog # wifi-menu | |
# Utilities | |
pacman -S fish | |
# KDE | |
pacman -S plasma-meta |
#!/bin/sh | |
BUILD_DIR=$HOME/.rust-tool-build | |
# update_tool tool_name tool_binary | |
update_tool() { | |
rustup run nightly $2 --version 1>/dev/null 2>/dev/null | |
if [ $? -ne 0 ]; then | |
echo "Updating $1" |
;; -*- mode: emacs-lisp -*- | |
;; This file is loaded by Spacemacs at startup. | |
;; It must be stored in your home directory. | |
(defun dotspacemacs/layers () | |
"Configuration Layers declaration. | |
You should not put any user code in this function besides modifying the variable | |
values." | |
(setq-default | |
;; Base distribution to use. This is a layer contained in the directory |
struct Node<T> { | |
val: T, | |
next: Option<Box<Node<T>>>, | |
} | |
pub struct Stack<T> { | |
top: Option<Box<Node<T>>>, | |
} | |
impl <T>Stack<T> { |
#!/usr/bin/env perl | |
$latex = 'uplatex -synctex=1'; | |
$latex_silent = 'uplatex -synctex=1 -interaction=batchmode'; | |
$bibtex = 'upbibtex'; | |
$biber = 'biber --bblencoding=utf8 -u -U --output_safechars'; | |
$makeindex = 'mendex %O -o %D %S'; | |
$dvipdf = 'dvipdfmx %O -o %D %S'; | |
$max_repeat = 5; |
using u128_t = usigned __int128; | |
bool dwcas(u128_t* ptr, u128_t oldval, u128_t newval) { | |
return __sync_bool_compare_and_swap(ptr, oldval, newval); | |
} |
obj-m := hello-module.o | |
all: | |
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules | |
clean: | |
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean |