Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am o0ignition0o on github.
  • I am jeremylempereur (https://keybase.io/jeremylempereur) on keybase.
  • I have a public key whose fingerprint is 93E1 F8B0 6CF0 241E 5363 B9E9 E255 4847 D470 F328

To claim this, I am signing this object:

@o0Ignition0o
o0Ignition0o / main.rs
Last active Apr 24, 2018
Add a vector of actix routes
View main.rs
extern crate actix;
extern crate actix_web;
extern crate env_logger;
use actix_web::{server, App, HttpRequest};
struct Route {
path: String,
action: fn(HttpRequest) -> String,
}
@o0Ignition0o
o0Ignition0o / main.rs
Created Jun 8, 2018
impl trait vec !
View main.rs
trait MakesNoise {
fn make_noise(self) -> ();
}
struct Dog;
struct Cat;
impl MakesNoise for Dog {
fn make_noise(self) -> () {
println!("WOOF WOOF");
View cargo.lock
[[package]]
name = "actix"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"actix_derive 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-channel 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@o0Ignition0o
o0Ignition0o / lib.rs
Last active Jul 29, 2018
is_valid_ipv4_addr
View lib.rs
#![crate_type = "staticlib"]
#![feature(test)]
extern crate test;
extern crate libc;
use std::slice;
fn is_valid_ipv4_addr<'a>(addr: &'a [u8]) -> bool {
let mut maybe_octet: Option<u8> = None;
View main.rs
#![crate_type = "staticlib"]
#![feature(test)]
extern crate test;
extern crate libc;
use std::slice;
fn is_valid_ipv4_addr<'a>(addr: &'a [char]) -> bool {
let mut maybe_octet: Option<u8> = None;
View lib.rs
use std::slice;
pub fn is_valid_ipv4_addr<'a>(addr: &'a [u8]) -> bool {
let mut current_octet: Option<u8> = None;
let mut dots: u8 = 0;
for c in addr {
let c = *c as char;
match c {
'.' => {
View main.rs
#![crate_type = "staticlib"]
//#![feature(test)]
//extern crate test;
use std::slice;
use std::str;
#[inline]
fn try_apply_digit(current_octet: u8, digit_to_apply: u8) -> Option<u8> {
current_octet.checked_mul(10)?.checked_add(digit_to_apply)
@o0Ignition0o
o0Ignition0o / mount.rs
Created Nov 4, 2018
yew rust framework: mount component to dom macro
View mount.rs
pub enum MountError {
QuerySelectorError,
ElementNotFound(String)
}
impl From<TODO> for MountError {
fn from(_: TODO) -> Self {
MountError::QuerySelectorError
}
@o0Ignition0o
o0Ignition0o / main.rs
Created Dec 3, 2019
on joue avec des results
View main.rs
use rand::prelude::*;
#[derive(Debug)]
struct JaiPasDentierError {}
#[derive(Debug)]
struct JaiPasReussiError {}
#[derive(Debug)]
enum MyError {
You can’t perform that action at this time.