Adapt rust implementation to rust 0.11