This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[macro_use] | |
extern crate nom; | |
#[derive(Debug, PartialEq)] | |
pub struct MacAddress<'a>(&'a u8, &'a u8, &'a u8, &'a u8, &'a u8, &'a u8); | |
#[derive(Debug, PartialEq)] | |
pub enum EtherType { | |
IPv4, | |
ARP, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "include/Func.h" | |
#include <stdio.h> | |
struct baz { int value; }; | |
EITHER(struct baz *, baz, char, bax); | |
int main(void) { | |
struct baz value = { 3 }; | |
Either(baz, bax) result = Left_baz_bax(&value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double average(const std::vector<uint32_t> & input) { | |
return std::accumulate(input.cbegin(), | |
input.cend(), | |
0) / (double)input.size(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double average(const std::vector<int> & input){ | |
return std::reduce(std::execution::par, | |
input.cbegin(), | |
input.cend(), | |
0) / (double)input.length(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <iostream> | |
#include <vector> | |
int main(void) { | |
// Create a vector | |
std::vector<uint32_t> v = {1, 2, 3, 4, 5}; | |
// Filter by copying | |
std::vector<uint32_t> res; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <iostream> | |
#include <vector> | |
int main(void) { | |
// Create a vector | |
std::vector<uint32_t> v = {1, 2, 3, 4, 5}; | |
// Filter by erase-remove | |
v.erase(std::remove_if(v.begin(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
auto average(const std::vector<uint32_t> & input) -> double; | |
int main(void) { | |
// Create a vector | |
std::vector<uint32_t> v = {9, 8, 3}; | |
// Get the average |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <numeric> | |
#include <vector> | |
int main(void) { | |
// Create a vector | |
std::vector<std::string> v{"foo", "bar"}; | |
// Fold by reference | |
std::string res = ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> make frontend | |
Compiling webapp v0.3.0 (file:///home/sascha/webapp.rs) | |
Finished release [optimized] target(s) in 11.86s | |
Garbage collecting "app.wasm"... | |
Processing "app.wasm"... | |
Finished processing of "app.wasm"! | |
If you need to serve any extra files put them in the 'static' directory | |
in the root of your crate; they will be served alongside your application. | |
You can also put a 'static' directory in your 'src' directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl Renderable<LoginComponent> for LoginComponent { | |
fn view(&self) -> Html<Self> { | |
html! { | |
<div class="uk-card uk-card-default uk-card-body uk-width-1-3@s uk-position-center",> | |
<form onsubmit="return false",> | |
<fieldset class="uk-fieldset",> | |
<legend class="uk-legend",>{"Authentication"}</legend> | |
<div class="uk-margin",> | |
<input class="uk-input", | |
placeholder="Username", |
OlderNewer